@mastra/core 1.18.0-alpha.1 → 1.18.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/dist/agent/agent-legacy.d.ts +3 -3
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +12 -12
- 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/agent/types.d.ts +12 -12
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +2 -1
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
- package/dist/{chunk-3U4ZNZIF.js → chunk-32NEFSTI.js} +168 -59
- package/dist/chunk-32NEFSTI.js.map +1 -0
- package/dist/{chunk-G62XEVSI.cjs → chunk-3UM5VCQ5.cjs} +3 -3
- package/dist/{chunk-G62XEVSI.cjs.map → chunk-3UM5VCQ5.cjs.map} +1 -1
- package/dist/{chunk-GFBH7Q4W.cjs → chunk-4K2NKQGN.cjs} +331 -222
- package/dist/chunk-4K2NKQGN.cjs.map +1 -0
- package/dist/{chunk-Z3VUDCXI.cjs → chunk-5IZ346TV.cjs} +7 -7
- package/dist/{chunk-Z3VUDCXI.cjs.map → chunk-5IZ346TV.cjs.map} +1 -1
- package/dist/{chunk-R2V6BCYX.cjs → chunk-64565EZF.cjs} +9 -9
- package/dist/{chunk-R2V6BCYX.cjs.map → chunk-64565EZF.cjs.map} +1 -1
- package/dist/{chunk-MSDZQ4DW.cjs → chunk-6LHF5UDX.cjs} +9 -9
- package/dist/{chunk-MSDZQ4DW.cjs.map → chunk-6LHF5UDX.cjs.map} +1 -1
- package/dist/{chunk-BYJDWJCX.js → chunk-7USX5P3I.js} +3 -3
- package/dist/{chunk-BYJDWJCX.js.map → chunk-7USX5P3I.js.map} +1 -1
- package/dist/{chunk-FWDG2WUV.js → chunk-AHFHYQS6.js} +3 -3
- package/dist/{chunk-FWDG2WUV.js.map → chunk-AHFHYQS6.js.map} +1 -1
- package/dist/{chunk-G5HKDGNT.cjs → chunk-B6D4D2CY.cjs} +2 -2
- package/dist/{chunk-G5HKDGNT.cjs.map → chunk-B6D4D2CY.cjs.map} +1 -1
- package/dist/{chunk-RB2QRGRV.js → chunk-BFRUEBG3.js} +4 -4
- package/dist/{chunk-RB2QRGRV.js.map → chunk-BFRUEBG3.js.map} +1 -1
- package/dist/{chunk-CT4YYQI3.js → chunk-CX5I6VS4.js} +2 -2
- package/dist/{chunk-CT4YYQI3.js.map → chunk-CX5I6VS4.js.map} +1 -1
- package/dist/{chunk-UQ2HAEHL.js → chunk-D5VCCQ4L.js} +5 -5
- package/dist/{chunk-UQ2HAEHL.js.map → chunk-D5VCCQ4L.js.map} +1 -1
- package/dist/{chunk-A2Z26HFR.js → chunk-FB6O7FNK.js} +42 -61
- package/dist/chunk-FB6O7FNK.js.map +1 -0
- package/dist/{chunk-PQWEJELD.cjs → chunk-GVHBM6VU.cjs} +6 -6
- package/dist/{chunk-PQWEJELD.cjs.map → chunk-GVHBM6VU.cjs.map} +1 -1
- package/dist/{chunk-ZOJZL62I.js → chunk-HDPQ3LEE.js} +4 -4
- package/dist/{chunk-ZOJZL62I.js.map → chunk-HDPQ3LEE.js.map} +1 -1
- package/dist/{chunk-TKKBZUWD.js → chunk-IR4WRS3N.js} +38 -14
- package/dist/chunk-IR4WRS3N.js.map +1 -0
- package/dist/{chunk-D4DCPE5Y.js → chunk-MP2VGF73.js} +3 -3
- package/dist/{chunk-D4DCPE5Y.js.map → chunk-MP2VGF73.js.map} +1 -1
- package/dist/{chunk-KL2IRBNK.cjs → chunk-OKKJRRSS.cjs} +39 -15
- package/dist/chunk-OKKJRRSS.cjs.map +1 -0
- package/dist/{chunk-2U4M4SGY.cjs → chunk-OVWOD5GI.cjs} +53 -72
- package/dist/chunk-OVWOD5GI.cjs.map +1 -0
- package/dist/{chunk-MBJ6IAKF.cjs → chunk-OXS5X7PW.cjs} +13 -13
- package/dist/{chunk-MBJ6IAKF.cjs.map → chunk-OXS5X7PW.cjs.map} +1 -1
- package/dist/{chunk-HEHK7LXS.js → chunk-OYAHOEQP.js} +4 -4
- package/dist/{chunk-HEHK7LXS.js.map → chunk-OYAHOEQP.js.map} +1 -1
- package/dist/{chunk-UPCNNWXW.cjs → chunk-PYNUWPGW.cjs} +19 -19
- package/dist/{chunk-UPCNNWXW.cjs.map → chunk-PYNUWPGW.cjs.map} +1 -1
- package/dist/{chunk-7IDACSBM.cjs → chunk-QXPUTX3W.cjs} +32 -32
- package/dist/chunk-QXPUTX3W.cjs.map +1 -0
- package/dist/{chunk-VMKNS3YO.js → chunk-SLHDZJ4B.js} +3 -3
- package/dist/chunk-SLHDZJ4B.js.map +1 -0
- package/dist/{chunk-3O73Q6M2.cjs → chunk-T5XU5TAV.cjs} +82 -82
- package/dist/{chunk-3O73Q6M2.cjs.map → chunk-T5XU5TAV.cjs.map} +1 -1
- package/dist/{chunk-3NMSFQPY.js → chunk-UORUVXKY.js} +5 -5
- package/dist/{chunk-3NMSFQPY.js.map → chunk-UORUVXKY.js.map} +1 -1
- package/dist/{chunk-JFPVUKPB.cjs → chunk-VVR3SFKH.cjs} +68 -68
- package/dist/{chunk-JFPVUKPB.cjs.map → chunk-VVR3SFKH.cjs.map} +1 -1
- package/dist/{chunk-EYM6DWKD.js → chunk-W2QYKEBN.js} +5 -5
- package/dist/{chunk-EYM6DWKD.js.map → chunk-W2QYKEBN.js.map} +1 -1
- package/dist/{chunk-PK3X5KIF.cjs → chunk-X36INADV.cjs} +23 -23
- package/dist/{chunk-PK3X5KIF.cjs.map → chunk-X36INADV.cjs.map} +1 -1
- package/dist/{chunk-WYFCQAHY.js → chunk-YBVRBNRY.js} +7 -7
- package/dist/{chunk-WYFCQAHY.js.map → chunk-YBVRBNRY.js.map} +1 -1
- package/dist/{chunk-K22Q6XPG.js → chunk-ZFH5KWHO.js} +3 -3
- package/dist/{chunk-K22Q6XPG.js.map → chunk-ZFH5KWHO.js.map} +1 -1
- package/dist/{chunk-UEZU2TA2.cjs → chunk-ZFZ6HQFT.cjs} +185 -185
- package/dist/{chunk-UEZU2TA2.cjs.map → chunk-ZFZ6HQFT.cjs.map} +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -3
- package/dist/docs/assets/SOURCE_MAP.json +469 -469
- package/dist/docs/references/docs-memory-observational-memory.md +49 -4
- package/dist/docs/references/docs-server-mastra-client.md +17 -0
- package/dist/docs/references/reference-client-js-agents.md +11 -6
- package/dist/docs/references/reference-evals-scorer-utils.md +9 -5
- package/dist/docs/references/reference-evals-trajectory-accuracy.md +29 -15
- package/dist/docs/references/reference-logging-pino-logger.md +58 -0
- package/dist/docs/references/reference-memory-observational-memory.md +32 -6
- package/dist/docs/references/reference.md +0 -2
- package/dist/evals/index.cjs +23 -23
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +7 -7
- package/dist/evals/scoreTraces/index.js +3 -3
- package/dist/evals/types.d.ts +58 -28
- package/dist/evals/types.d.ts.map +1 -1
- package/dist/harness/harness.d.ts.map +1 -1
- package/dist/harness/index.cjs +28 -8
- package/dist/harness/index.cjs.map +1 -1
- package/dist/harness/index.js +26 -6
- package/dist/harness/index.js.map +1 -1
- 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 +14 -2
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +11 -0
- 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/memory/memory.d.ts.map +1 -1
- package/dist/memory/types.d.ts +16 -2
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/models-dev-MIC2CW43.cjs +12 -0
- package/dist/{models-dev-BJHT4GXA.cjs.map → models-dev-MIC2CW43.cjs.map} +1 -1
- package/dist/models-dev-VDZIOMAC.js +3 -0
- package/dist/{models-dev-3U6ICCNW.js.map → models-dev-VDZIOMAC.js.map} +1 -1
- package/dist/netlify-2CGMKEKT.js +3 -0
- package/dist/{netlify-DE3IXMT2.js.map → netlify-2CGMKEKT.js.map} +1 -1
- package/dist/netlify-KZ4HQR5N.cjs +12 -0
- package/dist/{netlify-UARJYMCW.cjs.map → netlify-KZ4HQR5N.cjs.map} +1 -1
- package/dist/observability/index.cjs +18 -18
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +3 -0
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +44 -44
- package/dist/processors/index.js +1 -1
- package/dist/processors/tool-result-reminder.d.ts +2 -0
- package/dist/processors/tool-result-reminder.d.ts.map +1 -1
- package/dist/provider-registry-HGWTTWCL.cjs +40 -0
- package/dist/{provider-registry-65CPGTUU.cjs.map → provider-registry-HGWTTWCL.cjs.map} +1 -1
- package/dist/provider-registry-QRWUBN5N.js +3 -0
- package/dist/{provider-registry-EQAT7FXK.js.map → provider-registry-QRWUBN5N.js.map} +1 -1
- package/dist/provider-registry.json +34 -10
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/index.cjs +268 -268
- 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 +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/package.json +5 -4
- package/src/llm/model/provider-types.generated.d.ts +14 -2
- package/dist/chunk-2U4M4SGY.cjs.map +0 -1
- package/dist/chunk-3U4ZNZIF.js.map +0 -1
- package/dist/chunk-7IDACSBM.cjs.map +0 -1
- package/dist/chunk-A2Z26HFR.js.map +0 -1
- package/dist/chunk-GFBH7Q4W.cjs.map +0 -1
- package/dist/chunk-KL2IRBNK.cjs.map +0 -1
- package/dist/chunk-TKKBZUWD.js.map +0 -1
- package/dist/chunk-VMKNS3YO.js.map +0 -1
- package/dist/docs/references/reference-core-getStoredAgentById.md +0 -87
- package/dist/docs/references/reference-core-listStoredAgents.md +0 -91
- package/dist/models-dev-3U6ICCNW.js +0 -3
- package/dist/models-dev-BJHT4GXA.cjs +0 -12
- package/dist/netlify-DE3IXMT2.js +0 -3
- package/dist/netlify-UARJYMCW.cjs +0 -12
- package/dist/provider-registry-65CPGTUU.cjs +0 -40
- package/dist/provider-registry-EQAT7FXK.js +0 -3
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
var chunkZC4FJVJZ_cjs = require('./chunk-ZC4FJVJZ.cjs');
|
|
4
4
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
5
5
|
var chunkQVVWKMFM_cjs = require('./chunk-QVVWKMFM.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkX36INADV_cjs = require('./chunk-X36INADV.cjs');
|
|
7
7
|
var chunkANLO4VM2_cjs = require('./chunk-ANLO4VM2.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
|
|
11
|
+
var chunkT5XU5TAV_cjs = require('./chunk-T5XU5TAV.cjs');
|
|
12
|
+
var chunkOXS5X7PW_cjs = require('./chunk-OXS5X7PW.cjs');
|
|
13
13
|
var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
|
|
14
14
|
var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var chunk64565EZF_cjs = require('./chunk-64565EZF.cjs');
|
|
16
|
+
var chunkB6D4D2CY_cjs = require('./chunk-B6D4D2CY.cjs');
|
|
17
17
|
var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
|
|
18
18
|
var chunkK4NN2KQQ_cjs = require('./chunk-K4NN2KQQ.cjs');
|
|
19
19
|
var chunkXB4FLS7A_cjs = require('./chunk-XB4FLS7A.cjs');
|
|
@@ -31,6 +31,7 @@ var radash = require('radash');
|
|
|
31
31
|
var providerUtilsV5 = require('@ai-sdk/provider-utils-v5');
|
|
32
32
|
var fs = require('fs');
|
|
33
33
|
var path = require('path');
|
|
34
|
+
var tokenx = require('tokenx');
|
|
34
35
|
var xxhash = require('xxhash-wasm');
|
|
35
36
|
var lruCache = require('lru-cache');
|
|
36
37
|
|
|
@@ -794,7 +795,7 @@ var StructuredOutputProcessor = class {
|
|
|
794
795
|
}
|
|
795
796
|
async processOutputStream(args) {
|
|
796
797
|
const { part, state, streamParts, abort, ...rest } = args;
|
|
797
|
-
const observabilityContext =
|
|
798
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
798
799
|
const controller = state.controller;
|
|
799
800
|
switch (part.type) {
|
|
800
801
|
case "finish":
|
|
@@ -1091,7 +1092,7 @@ var ProcessorState = class {
|
|
|
1091
1092
|
this.span = parentSpan?.createChildSpan({
|
|
1092
1093
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1093
1094
|
name: `output stream processor: ${options.processorName}`,
|
|
1094
|
-
entityType:
|
|
1095
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
1095
1096
|
entityName: options.processorName,
|
|
1096
1097
|
attributes: {
|
|
1097
1098
|
processorExecutor: "legacy",
|
|
@@ -1268,7 +1269,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1268
1269
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1269
1270
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1270
1271
|
name: `output processor: ${processor.id}`,
|
|
1271
|
-
entityType:
|
|
1272
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
1272
1273
|
entityId: processor.id,
|
|
1273
1274
|
entityName: processor.name,
|
|
1274
1275
|
attributes: {
|
|
@@ -1292,7 +1293,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1292
1293
|
state: processorState.customState,
|
|
1293
1294
|
result: result ?? defaultResult,
|
|
1294
1295
|
abort,
|
|
1295
|
-
...
|
|
1296
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1296
1297
|
requestContext,
|
|
1297
1298
|
retryCount,
|
|
1298
1299
|
writer
|
|
@@ -1426,7 +1427,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1426
1427
|
abort: (reason, options) => {
|
|
1427
1428
|
throw new TripWire(reason || `Stream part blocked by ${processor.id}`, options, processor.id);
|
|
1428
1429
|
},
|
|
1429
|
-
...
|
|
1430
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: state.span }),
|
|
1430
1431
|
requestContext,
|
|
1431
1432
|
messageList,
|
|
1432
1433
|
retryCount,
|
|
@@ -1568,7 +1569,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1568
1569
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1569
1570
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1570
1571
|
name: `input processor: ${processor.id}`,
|
|
1571
|
-
entityType:
|
|
1572
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.INPUT_PROCESSOR,
|
|
1572
1573
|
entityId: processor.id,
|
|
1573
1574
|
entityName: processor.name,
|
|
1574
1575
|
attributes: {
|
|
@@ -1586,7 +1587,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1586
1587
|
systemMessages: currentSystemMessages,
|
|
1587
1588
|
state: processorState.customState,
|
|
1588
1589
|
abort,
|
|
1589
|
-
...
|
|
1590
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1590
1591
|
messageList,
|
|
1591
1592
|
requestContext,
|
|
1592
1593
|
retryCount
|
|
@@ -1697,7 +1698,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1697
1698
|
*/
|
|
1698
1699
|
async runProcessInputStep(args) {
|
|
1699
1700
|
const { messageList, stepNumber, steps, requestContext, writer } = args;
|
|
1700
|
-
const observabilityContext =
|
|
1701
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(args);
|
|
1701
1702
|
const stepInput = {
|
|
1702
1703
|
messageId: args.messageId,
|
|
1703
1704
|
tools: args.tools,
|
|
@@ -1767,7 +1768,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1767
1768
|
const processorSpan = currentSpan?.createChildSpan({
|
|
1768
1769
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1769
1770
|
name: `input step processor: ${processor.id}`,
|
|
1770
|
-
entityType:
|
|
1771
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.INPUT_STEP_PROCESSOR,
|
|
1771
1772
|
entityId: processor.id,
|
|
1772
1773
|
entityName: processor.name,
|
|
1773
1774
|
attributes: {
|
|
@@ -1798,7 +1799,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1798
1799
|
return nextMessageId;
|
|
1799
1800
|
}
|
|
1800
1801
|
} : {},
|
|
1801
|
-
...
|
|
1802
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1802
1803
|
retryCount: args.retryCount ?? 0,
|
|
1803
1804
|
writer,
|
|
1804
1805
|
abortSignal: args.abortSignal
|
|
@@ -1893,7 +1894,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1893
1894
|
retryCount = 0,
|
|
1894
1895
|
writer
|
|
1895
1896
|
} = args;
|
|
1896
|
-
const observabilityContext =
|
|
1897
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(args);
|
|
1897
1898
|
for (const [index, processorOrWorkflow] of this.outputProcessors.entries()) {
|
|
1898
1899
|
const processableMessages = messageList.get.all.db();
|
|
1899
1900
|
const idsBeforeProcessing = processableMessages.map((m) => m.id);
|
|
@@ -1933,7 +1934,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1933
1934
|
const processorSpan = parentSpan?.createChildSpan({
|
|
1934
1935
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
1935
1936
|
name: `output step processor: ${processor.id}`,
|
|
1936
|
-
entityType:
|
|
1937
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.OUTPUT_STEP_PROCESSOR,
|
|
1937
1938
|
entityId: processor.id,
|
|
1938
1939
|
entityName: processor.name,
|
|
1939
1940
|
attributes: {
|
|
@@ -1957,7 +1958,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
1957
1958
|
steps,
|
|
1958
1959
|
state: processorState.customState,
|
|
1959
1960
|
abort,
|
|
1960
|
-
...
|
|
1961
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
1961
1962
|
requestContext,
|
|
1962
1963
|
retryCount,
|
|
1963
1964
|
writer
|
|
@@ -2071,7 +2072,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2071
2072
|
}
|
|
2072
2073
|
const { model: _model, ...rest } = result;
|
|
2073
2074
|
if (result.model) {
|
|
2074
|
-
const resolvedModel = await
|
|
2075
|
+
const resolvedModel = await chunkT5XU5TAV_cjs.resolveModelConfig(result.model);
|
|
2075
2076
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
2076
2077
|
if (!isSupported) {
|
|
2077
2078
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -2816,7 +2817,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
2816
2817
|
this.#transportRef = options.transportRef;
|
|
2817
2818
|
this.#returnScorerData = !!options.returnScorerData;
|
|
2818
2819
|
this.runId = options.runId;
|
|
2819
|
-
const resultSpan =
|
|
2820
|
+
const resultSpan = chunkB6D4D2CY_cjs.getRootExportSpan(options.tracingContext?.currentSpan);
|
|
2820
2821
|
this.traceId = resultSpan?.externalTraceId;
|
|
2821
2822
|
this.spanId = resultSpan?.id;
|
|
2822
2823
|
this.#model = _model;
|
|
@@ -2878,7 +2879,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
2878
2879
|
} = await processorRunner.processPart(
|
|
2879
2880
|
chunk,
|
|
2880
2881
|
processorStates,
|
|
2881
|
-
|
|
2882
|
+
chunkB6D4D2CY_cjs.resolveObservabilityContext(options),
|
|
2882
2883
|
options.requestContext,
|
|
2883
2884
|
self.messageList,
|
|
2884
2885
|
0,
|
|
@@ -3270,7 +3271,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
3270
3271
|
};
|
|
3271
3272
|
self.messageList = await self.processorRunner.runOutputProcessors(
|
|
3272
3273
|
self.messageList,
|
|
3273
|
-
|
|
3274
|
+
chunkB6D4D2CY_cjs.resolveObservabilityContext(options),
|
|
3274
3275
|
self.#options.requestContext,
|
|
3275
3276
|
0,
|
|
3276
3277
|
outputResultWriter,
|
|
@@ -4845,7 +4846,7 @@ var getModelOutputForTripwire = async ({
|
|
|
4845
4846
|
messageList,
|
|
4846
4847
|
...rest
|
|
4847
4848
|
}) => {
|
|
4848
|
-
const observabilityContext =
|
|
4849
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
4849
4850
|
const tripwireStream = new web.ReadableStream({
|
|
4850
4851
|
start(controller) {
|
|
4851
4852
|
controller.enqueue({
|
|
@@ -5497,7 +5498,7 @@ var createTimeTravelExecutionParams = (params) => {
|
|
|
5497
5498
|
result = void 0;
|
|
5498
5499
|
}
|
|
5499
5500
|
if (result) {
|
|
5500
|
-
const formattedResult =
|
|
5501
|
+
const formattedResult = chunk64565EZF_cjs.removeUndefinedValues(result);
|
|
5501
5502
|
stepResults[stepId] = formattedResult;
|
|
5502
5503
|
}
|
|
5503
5504
|
});
|
|
@@ -5589,7 +5590,7 @@ async function executeParallel(engine, params) {
|
|
|
5589
5590
|
perStep,
|
|
5590
5591
|
...rest
|
|
5591
5592
|
} = params;
|
|
5592
|
-
const observabilityContext =
|
|
5593
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
5593
5594
|
const parallelSpan = await engine.createChildSpan({
|
|
5594
5595
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
5595
5596
|
operationId: `workflow.${workflowId}.run.${runId}.parallel.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -5667,7 +5668,7 @@ async function executeParallel(engine, params) {
|
|
|
5667
5668
|
state: executionContext.state,
|
|
5668
5669
|
tracingIds: executionContext.tracingIds
|
|
5669
5670
|
},
|
|
5670
|
-
...
|
|
5671
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: parallelSpan }),
|
|
5671
5672
|
pubsub,
|
|
5672
5673
|
abortController,
|
|
5673
5674
|
requestContext,
|
|
@@ -5743,7 +5744,7 @@ async function executeConditional(engine, params) {
|
|
|
5743
5744
|
perStep,
|
|
5744
5745
|
...rest
|
|
5745
5746
|
} = params;
|
|
5746
|
-
const observabilityContext =
|
|
5747
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
5747
5748
|
const conditionalSpan = await engine.createChildSpan({
|
|
5748
5749
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
5749
5750
|
operationId: `workflow.${workflowId}.run.${runId}.conditional.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -5785,7 +5786,7 @@ async function executeConditional(engine, params) {
|
|
|
5785
5786
|
inputData: prevOutput,
|
|
5786
5787
|
state: executionContext.state,
|
|
5787
5788
|
retryCount: -1,
|
|
5788
|
-
...
|
|
5789
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
5789
5790
|
getInitData: () => stepResults?.input,
|
|
5790
5791
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
5791
5792
|
bail: (() => {
|
|
@@ -5906,7 +5907,7 @@ async function executeConditional(engine, params) {
|
|
|
5906
5907
|
state: executionContext.state,
|
|
5907
5908
|
tracingIds: executionContext.tracingIds
|
|
5908
5909
|
},
|
|
5909
|
-
...
|
|
5910
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: conditionalSpan }),
|
|
5910
5911
|
pubsub,
|
|
5911
5912
|
abortController,
|
|
5912
5913
|
requestContext,
|
|
@@ -5983,7 +5984,7 @@ async function executeLoop(engine, params) {
|
|
|
5983
5984
|
perStep,
|
|
5984
5985
|
...rest
|
|
5985
5986
|
} = params;
|
|
5986
|
-
const observabilityContext =
|
|
5987
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
5987
5988
|
const { step, condition } = entry;
|
|
5988
5989
|
const loopSpan = await engine.createChildSpan({
|
|
5989
5990
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -6019,7 +6020,7 @@ async function executeLoop(engine, params) {
|
|
|
6019
6020
|
resume: currentResume,
|
|
6020
6021
|
timeTravel: currentTimeTravel,
|
|
6021
6022
|
prevOutput: result.output,
|
|
6022
|
-
...
|
|
6023
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
6023
6024
|
pubsub,
|
|
6024
6025
|
abortController,
|
|
6025
6026
|
requestContext,
|
|
@@ -6055,7 +6056,7 @@ async function executeLoop(engine, params) {
|
|
|
6055
6056
|
options: {
|
|
6056
6057
|
type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
|
|
6057
6058
|
name: `condition: '${entry.loopType}'`,
|
|
6058
|
-
input:
|
|
6059
|
+
input: chunk64565EZF_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
|
|
6059
6060
|
attributes: {
|
|
6060
6061
|
conditionIndex: iteration
|
|
6061
6062
|
},
|
|
@@ -6073,7 +6074,7 @@ async function executeLoop(engine, params) {
|
|
|
6073
6074
|
inputData: result.output,
|
|
6074
6075
|
state: executionContext.state,
|
|
6075
6076
|
retryCount: -1,
|
|
6076
|
-
...
|
|
6077
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
6077
6078
|
iterationCount: iteration + 1,
|
|
6078
6079
|
getInitData: () => stepResults?.input,
|
|
6079
6080
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
@@ -6145,7 +6146,7 @@ async function executeForeach(engine, params) {
|
|
|
6145
6146
|
perStep,
|
|
6146
6147
|
...rest
|
|
6147
6148
|
} = params;
|
|
6148
|
-
const observabilityContext =
|
|
6149
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
6149
6150
|
const { step, opts } = entry;
|
|
6150
6151
|
const results = [];
|
|
6151
6152
|
const concurrency = opts.concurrency;
|
|
@@ -6221,7 +6222,7 @@ async function executeForeach(engine, params) {
|
|
|
6221
6222
|
executionContext: { ...executionContext, foreachIndex: k },
|
|
6222
6223
|
resume: resumeToUse,
|
|
6223
6224
|
prevOutput: item,
|
|
6224
|
-
...
|
|
6225
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
6225
6226
|
pubsub,
|
|
6226
6227
|
abortController,
|
|
6227
6228
|
requestContext,
|
|
@@ -6508,7 +6509,7 @@ async function executeEntry(engine, params) {
|
|
|
6508
6509
|
perStep,
|
|
6509
6510
|
...rest
|
|
6510
6511
|
} = params;
|
|
6511
|
-
const observabilityContext =
|
|
6512
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
6512
6513
|
const prevOutput = engine.getStepOutput(stepResults, prevStep);
|
|
6513
6514
|
let execResults;
|
|
6514
6515
|
let entryRequestContext;
|
|
@@ -6977,7 +6978,7 @@ async function executeSleep(engine, params) {
|
|
|
6977
6978
|
outputWriter,
|
|
6978
6979
|
...rest
|
|
6979
6980
|
} = params;
|
|
6980
|
-
const observabilityContext =
|
|
6981
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
6981
6982
|
let { duration, fn } = entry;
|
|
6982
6983
|
const sleepSpan = await engine.createChildSpan({
|
|
6983
6984
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -7006,7 +7007,7 @@ async function executeSleep(engine, params) {
|
|
|
7006
7007
|
executionContext.state = state;
|
|
7007
7008
|
},
|
|
7008
7009
|
retryCount: -1,
|
|
7009
|
-
...
|
|
7010
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: sleepSpan }),
|
|
7010
7011
|
getInitData: () => stepResults?.input,
|
|
7011
7012
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7012
7013
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -7067,7 +7068,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
7067
7068
|
outputWriter,
|
|
7068
7069
|
...rest
|
|
7069
7070
|
} = params;
|
|
7070
|
-
const observabilityContext =
|
|
7071
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
7071
7072
|
let { date, fn } = entry;
|
|
7072
7073
|
const sleepUntilSpan = await engine.createChildSpan({
|
|
7073
7074
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -7097,7 +7098,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
7097
7098
|
executionContext.state = state;
|
|
7098
7099
|
},
|
|
7099
7100
|
retryCount: -1,
|
|
7100
|
-
...
|
|
7101
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: sleepUntilSpan }),
|
|
7101
7102
|
getInitData: () => stepResults?.input,
|
|
7102
7103
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7103
7104
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -7176,7 +7177,7 @@ async function executeStep(engine, params) {
|
|
|
7176
7177
|
perStep,
|
|
7177
7178
|
...rest
|
|
7178
7179
|
} = params;
|
|
7179
|
-
const observabilityContext =
|
|
7180
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
7180
7181
|
const stepCallId = crypto2.randomUUID();
|
|
7181
7182
|
const { inputData, validationError: inputValidationError } = await validateStepInput({
|
|
7182
7183
|
prevOutput,
|
|
@@ -7227,7 +7228,7 @@ async function executeStep(engine, params) {
|
|
|
7227
7228
|
options: {
|
|
7228
7229
|
name: `workflow step: '${step.id}'`,
|
|
7229
7230
|
type: "workflow_step" /* WORKFLOW_STEP */,
|
|
7230
|
-
entityType:
|
|
7231
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.WORKFLOW_STEP,
|
|
7231
7232
|
entityId: step.id,
|
|
7232
7233
|
input: inputData,
|
|
7233
7234
|
tracingPolicy: engine.options?.tracingPolicy,
|
|
@@ -7315,7 +7316,7 @@ async function executeStep(engine, params) {
|
|
|
7315
7316
|
deprecationMessage: runCountDeprecationMessage,
|
|
7316
7317
|
logger: engine.getLogger()
|
|
7317
7318
|
});
|
|
7318
|
-
return
|
|
7319
|
+
return chunkB6D4D2CY_cjs.executeWithContext({ span: stepSpan, fn: () => step.execute(proxiedData) });
|
|
7319
7320
|
};
|
|
7320
7321
|
let execResults;
|
|
7321
7322
|
const retries = step.retries ?? executionContext.retryConfig.attempts ?? 0;
|
|
@@ -7340,7 +7341,7 @@ async function executeStep(engine, params) {
|
|
|
7340
7341
|
requestContextUpdate: null
|
|
7341
7342
|
};
|
|
7342
7343
|
const isNestedWorkflow = step.component === "WORKFLOW";
|
|
7343
|
-
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra :
|
|
7344
|
+
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra : chunkB6D4D2CY_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0;
|
|
7344
7345
|
const output = await runStep({
|
|
7345
7346
|
runId,
|
|
7346
7347
|
resourceId,
|
|
@@ -7363,7 +7364,7 @@ async function executeStep(engine, params) {
|
|
|
7363
7364
|
retryCount,
|
|
7364
7365
|
resumeData: resumeDataToUse,
|
|
7365
7366
|
suspendData: suspendDataToUse,
|
|
7366
|
-
...
|
|
7367
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: stepSpan }),
|
|
7367
7368
|
getInitData: () => stepResults?.input,
|
|
7368
7369
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
7369
7370
|
suspend: async (suspendPayload, suspendOptions) => {
|
|
@@ -7465,7 +7466,7 @@ async function executeStep(engine, params) {
|
|
|
7465
7466
|
stepId: step.id,
|
|
7466
7467
|
requestContext,
|
|
7467
7468
|
disableScorers,
|
|
7468
|
-
...
|
|
7469
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: stepSpan })
|
|
7469
7470
|
});
|
|
7470
7471
|
}
|
|
7471
7472
|
if (durableResult.suspended) {
|
|
@@ -7521,7 +7522,7 @@ async function executeStep(engine, params) {
|
|
|
7521
7522
|
}
|
|
7522
7523
|
async function runScorersForStep(params) {
|
|
7523
7524
|
const { engine, scorers, runId, input, output, workflowId, stepId, requestContext, disableScorers, ...rest } = params;
|
|
7524
|
-
const observabilityContext =
|
|
7525
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
7525
7526
|
let scorersToUse = scorers;
|
|
7526
7527
|
if (typeof scorersToUse === "function") {
|
|
7527
7528
|
try {
|
|
@@ -8094,7 +8095,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
8094
8095
|
resume,
|
|
8095
8096
|
timeTravel,
|
|
8096
8097
|
restart,
|
|
8097
|
-
...
|
|
8098
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: workflowSpan }),
|
|
8098
8099
|
abortController: params.abortController,
|
|
8099
8100
|
pubsub: params.pubsub,
|
|
8100
8101
|
requestContext: currentRequestContext,
|
|
@@ -8390,7 +8391,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
|
|
|
8390
8391
|
writer,
|
|
8391
8392
|
...rest
|
|
8392
8393
|
}) => {
|
|
8393
|
-
const observabilityContext =
|
|
8394
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
8394
8395
|
let streamPromise = {};
|
|
8395
8396
|
streamPromise.promise = new Promise((resolve2, reject) => {
|
|
8396
8397
|
streamPromise.resolve = resolve2;
|
|
@@ -8518,7 +8519,7 @@ function createStepFromTool(params, toolOpts) {
|
|
|
8518
8519
|
setState,
|
|
8519
8520
|
...rest
|
|
8520
8521
|
}) => {
|
|
8521
|
-
const observabilityContext =
|
|
8522
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
8522
8523
|
const toolContext = {
|
|
8523
8524
|
mastra,
|
|
8524
8525
|
requestContext,
|
|
@@ -8542,16 +8543,16 @@ function createStepFromProcessor(processor) {
|
|
|
8542
8543
|
const getProcessorEntityType = (phase) => {
|
|
8543
8544
|
switch (phase) {
|
|
8544
8545
|
case "input":
|
|
8545
|
-
return
|
|
8546
|
+
return chunkB6D4D2CY_cjs.EntityType.INPUT_PROCESSOR;
|
|
8546
8547
|
case "inputStep":
|
|
8547
|
-
return
|
|
8548
|
+
return chunkB6D4D2CY_cjs.EntityType.INPUT_STEP_PROCESSOR;
|
|
8548
8549
|
case "outputStream":
|
|
8549
8550
|
case "outputResult":
|
|
8550
|
-
return
|
|
8551
|
+
return chunkB6D4D2CY_cjs.EntityType.OUTPUT_PROCESSOR;
|
|
8551
8552
|
case "outputStep":
|
|
8552
|
-
return
|
|
8553
|
+
return chunkB6D4D2CY_cjs.EntityType.OUTPUT_STEP_PROCESSOR;
|
|
8553
8554
|
default:
|
|
8554
|
-
return
|
|
8555
|
+
return chunkB6D4D2CY_cjs.EntityType.OUTPUT_PROCESSOR;
|
|
8555
8556
|
}
|
|
8556
8557
|
};
|
|
8557
8558
|
const getSpanNamePrefix = (phase) => {
|
|
@@ -8649,7 +8650,7 @@ function createStepFromProcessor(processor) {
|
|
|
8649
8650
|
processorIndex: processor.processorIndex
|
|
8650
8651
|
}
|
|
8651
8652
|
}) : void 0;
|
|
8652
|
-
const processorObservabilityContext =
|
|
8653
|
+
const processorObservabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext(
|
|
8653
8654
|
processorSpan ? { currentSpan: processorSpan } : tracingContext
|
|
8654
8655
|
);
|
|
8655
8656
|
const processorWriter = outputWriter ? {
|
|
@@ -8707,7 +8708,7 @@ function createStepFromProcessor(processor) {
|
|
|
8707
8708
|
};
|
|
8708
8709
|
const executePhaseWithSpan = async (fn) => {
|
|
8709
8710
|
try {
|
|
8710
|
-
const result = await
|
|
8711
|
+
const result = await chunkB6D4D2CY_cjs.executeWithContext({ span: processorSpan, fn });
|
|
8711
8712
|
processorSpan?.end({ output: result });
|
|
8712
8713
|
return result;
|
|
8713
8714
|
} catch (error) {
|
|
@@ -8851,7 +8852,7 @@ function createStepFromProcessor(processor) {
|
|
|
8851
8852
|
processorSpan2 = parentSpan.createChildSpan({
|
|
8852
8853
|
type: "processor_run" /* PROCESSOR_RUN */,
|
|
8853
8854
|
name: `output stream processor: ${processor.id}`,
|
|
8854
|
-
entityType:
|
|
8855
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.OUTPUT_PROCESSOR,
|
|
8855
8856
|
entityId: processor.id,
|
|
8856
8857
|
entityName: processor.name ?? processor.id,
|
|
8857
8858
|
input: { phase, totalChunks: 0 },
|
|
@@ -8868,7 +8869,7 @@ function createStepFromProcessor(processor) {
|
|
|
8868
8869
|
totalChunks: (streamParts ?? []).length
|
|
8869
8870
|
};
|
|
8870
8871
|
}
|
|
8871
|
-
const processorObservabilityContext2 =
|
|
8872
|
+
const processorObservabilityContext2 = chunkB6D4D2CY_cjs.createObservabilityContext(
|
|
8872
8873
|
processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext
|
|
8873
8874
|
);
|
|
8874
8875
|
let result;
|
|
@@ -9614,7 +9615,7 @@ var Workflow = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9614
9615
|
bail: _bail,
|
|
9615
9616
|
...rest
|
|
9616
9617
|
}) {
|
|
9617
|
-
const observabilityContext =
|
|
9618
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
9618
9619
|
this.__registerMastra(mastra);
|
|
9619
9620
|
const effectiveValidateInputs = validateInputs ?? this.#options.validateInputs ?? true;
|
|
9620
9621
|
this.#options = {
|
|
@@ -10112,11 +10113,11 @@ var Run = class {
|
|
|
10112
10113
|
perStep,
|
|
10113
10114
|
...rest
|
|
10114
10115
|
}) {
|
|
10115
|
-
const observabilityContext =
|
|
10116
|
-
const workflowSpan =
|
|
10116
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10117
|
+
const workflowSpan = chunkB6D4D2CY_cjs.getOrCreateSpan({
|
|
10117
10118
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10118
10119
|
name: `workflow run: '${this.workflowId}'`,
|
|
10119
|
-
entityType:
|
|
10120
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.WORKFLOW_RUN,
|
|
10120
10121
|
entityId: this.workflowId,
|
|
10121
10122
|
input: inputData,
|
|
10122
10123
|
metadata: {
|
|
@@ -10193,7 +10194,7 @@ var Run = class {
|
|
|
10193
10194
|
tracingOptions,
|
|
10194
10195
|
...rest
|
|
10195
10196
|
} = {}) {
|
|
10196
|
-
const observabilityContext =
|
|
10197
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10197
10198
|
if (this.closeStreamAction) {
|
|
10198
10199
|
return {
|
|
10199
10200
|
stream: this.observeStreamLegacy().stream,
|
|
@@ -10318,7 +10319,7 @@ var Run = class {
|
|
|
10318
10319
|
perStep,
|
|
10319
10320
|
...rest
|
|
10320
10321
|
}) {
|
|
10321
|
-
const observabilityContext =
|
|
10322
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10322
10323
|
if (this.closeStreamAction && this.streamOutput) {
|
|
10323
10324
|
return this.streamOutput;
|
|
10324
10325
|
}
|
|
@@ -10419,7 +10420,7 @@ var Run = class {
|
|
|
10419
10420
|
perStep,
|
|
10420
10421
|
...rest
|
|
10421
10422
|
} = {}) {
|
|
10422
|
-
const observabilityContext =
|
|
10423
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10423
10424
|
this.closeStreamAction = async () => {
|
|
10424
10425
|
};
|
|
10425
10426
|
const self = this;
|
|
@@ -10548,7 +10549,7 @@ var Run = class {
|
|
|
10548
10549
|
return this._restart(args);
|
|
10549
10550
|
}
|
|
10550
10551
|
async _resume(params) {
|
|
10551
|
-
const observabilityContext =
|
|
10552
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(params);
|
|
10552
10553
|
const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
|
|
10553
10554
|
const snapshot = await workflowsStore?.loadWorkflowSnapshot({
|
|
10554
10555
|
workflowName: this.workflowId,
|
|
@@ -10632,10 +10633,10 @@ var Run = class {
|
|
|
10632
10633
|
traceId: effectiveTraceId,
|
|
10633
10634
|
parentSpanId: shouldUsePersistedParentSpan ? persistedTracingContext?.spanId : params.tracingOptions?.parentSpanId
|
|
10634
10635
|
};
|
|
10635
|
-
const workflowSpan =
|
|
10636
|
+
const workflowSpan = chunkB6D4D2CY_cjs.getOrCreateSpan({
|
|
10636
10637
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10637
10638
|
name: `workflow run: '${this.workflowId}' (resumed)`,
|
|
10638
|
-
entityType:
|
|
10639
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.WORKFLOW_RUN,
|
|
10639
10640
|
entityId: this.workflowId,
|
|
10640
10641
|
input: resumeDataToUse,
|
|
10641
10642
|
metadata: {
|
|
@@ -10699,7 +10700,7 @@ var Run = class {
|
|
|
10699
10700
|
tracingOptions,
|
|
10700
10701
|
...rest
|
|
10701
10702
|
}) {
|
|
10702
|
-
const observabilityContext =
|
|
10703
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10703
10704
|
if (this.workflowEngineType !== "default") {
|
|
10704
10705
|
throw new Error(`restart() is not supported on ${this.workflowEngineType} workflows`);
|
|
10705
10706
|
}
|
|
@@ -10751,10 +10752,10 @@ var Run = class {
|
|
|
10751
10752
|
requestContextToUse.set(key, value);
|
|
10752
10753
|
}
|
|
10753
10754
|
}
|
|
10754
|
-
const workflowSpan =
|
|
10755
|
+
const workflowSpan = chunkB6D4D2CY_cjs.getOrCreateSpan({
|
|
10755
10756
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10756
10757
|
name: `workflow run: '${this.workflowId}'`,
|
|
10757
|
-
entityType:
|
|
10758
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.WORKFLOW_RUN,
|
|
10758
10759
|
entityId: this.workflowId,
|
|
10759
10760
|
metadata: {
|
|
10760
10761
|
resourceId: this.resourceId,
|
|
@@ -10804,7 +10805,7 @@ var Run = class {
|
|
|
10804
10805
|
perStep,
|
|
10805
10806
|
...rest
|
|
10806
10807
|
}) {
|
|
10807
|
-
const observabilityContext =
|
|
10808
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10808
10809
|
if (!stepParam || Array.isArray(stepParam) && stepParam.length === 0) {
|
|
10809
10810
|
throw new Error("Step is required and must be a valid step or array of steps");
|
|
10810
10811
|
}
|
|
@@ -10848,11 +10849,11 @@ var Run = class {
|
|
|
10848
10849
|
requestContextToUse.set(key, value);
|
|
10849
10850
|
}
|
|
10850
10851
|
}
|
|
10851
|
-
const workflowSpan =
|
|
10852
|
+
const workflowSpan = chunkB6D4D2CY_cjs.getOrCreateSpan({
|
|
10852
10853
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
10853
10854
|
name: `workflow run: '${this.workflowId}'`,
|
|
10854
10855
|
input: inputData,
|
|
10855
|
-
entityType:
|
|
10856
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.WORKFLOW_RUN,
|
|
10856
10857
|
entityId: this.workflowId,
|
|
10857
10858
|
metadata: {
|
|
10858
10859
|
resourceId: this.resourceId,
|
|
@@ -10906,7 +10907,7 @@ var Run = class {
|
|
|
10906
10907
|
perStep,
|
|
10907
10908
|
...rest
|
|
10908
10909
|
}) {
|
|
10909
|
-
const observabilityContext =
|
|
10910
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
10910
10911
|
this.closeStreamAction = async () => {
|
|
10911
10912
|
};
|
|
10912
10913
|
const self = this;
|
|
@@ -11212,7 +11213,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11212
11213
|
}
|
|
11213
11214
|
});
|
|
11214
11215
|
}
|
|
11215
|
-
const observabilityContext =
|
|
11216
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(input);
|
|
11216
11217
|
let runId = input.runId;
|
|
11217
11218
|
if (!runId) {
|
|
11218
11219
|
runId = crypto2.randomUUID();
|
|
@@ -11265,7 +11266,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11265
11266
|
inputSchema: v4.z.any(),
|
|
11266
11267
|
outputSchema: v4.z.any(),
|
|
11267
11268
|
execute: async ({ inputData, getInitData, ...rest }) => {
|
|
11268
|
-
const observabilityContext =
|
|
11269
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
11269
11270
|
const { accumulatedResults = {}, generatedPrompts = {} } = inputData;
|
|
11270
11271
|
const { run } = getInitData();
|
|
11271
11272
|
const context = this.createScorerContext(scorerStep.name, run, accumulatedResults);
|
|
@@ -11356,7 +11357,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
11356
11357
|
}
|
|
11357
11358
|
});
|
|
11358
11359
|
}
|
|
11359
|
-
const resolvedModel = await
|
|
11360
|
+
const resolvedModel = await chunkT5XU5TAV_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
11360
11361
|
const judge = new Agent({
|
|
11361
11362
|
id: "judge",
|
|
11362
11363
|
name: "judge",
|
|
@@ -12784,7 +12785,7 @@ function createLLMExecutionStep({
|
|
|
12784
12785
|
const processInputStepResult = await processorRunner.runProcessInputStep({
|
|
12785
12786
|
messageList,
|
|
12786
12787
|
stepNumber: inputData.output?.steps?.length || 0,
|
|
12787
|
-
...
|
|
12788
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext(stepTracingContext),
|
|
12788
12789
|
requestContext,
|
|
12789
12790
|
model,
|
|
12790
12791
|
steps: inputData.output?.steps || [],
|
|
@@ -12805,11 +12806,40 @@ function createLLMExecutionStep({
|
|
|
12805
12806
|
abortSignal: options?.abortSignal
|
|
12806
12807
|
});
|
|
12807
12808
|
Object.assign(currentStep, processInputStepResult);
|
|
12809
|
+
const modelChanged = processInputStepResult.model && processInputStepResult.model !== model;
|
|
12810
|
+
const modelSettingsChanged = processInputStepResult.modelSettings && processInputStepResult.modelSettings !== modelSettings;
|
|
12811
|
+
if (modelSpanTracker && (modelChanged || modelSettingsChanged)) {
|
|
12812
|
+
modelSpanTracker.updateGeneration({
|
|
12813
|
+
...modelChanged ? { name: `llm: '${currentStep.model.modelId}'` } : {},
|
|
12814
|
+
attributes: {
|
|
12815
|
+
...modelChanged ? {
|
|
12816
|
+
model: currentStep.model.modelId,
|
|
12817
|
+
provider: currentStep.model.provider
|
|
12818
|
+
} : {},
|
|
12819
|
+
...modelSettingsChanged ? { parameters: currentStep.modelSettings } : {}
|
|
12820
|
+
}
|
|
12821
|
+
});
|
|
12822
|
+
}
|
|
12823
|
+
const toolsChanged = processInputStepResult.tools && processInputStepResult.tools !== tools;
|
|
12824
|
+
const activeToolsChanged = processInputStepResult.activeTools && processInputStepResult.activeTools !== activeTools;
|
|
12825
|
+
if (toolsChanged || activeToolsChanged) {
|
|
12826
|
+
const agentSpan = tracingContext?.currentSpan?.findParent("agent_run" /* AGENT_RUN */);
|
|
12827
|
+
if (agentSpan) {
|
|
12828
|
+
const toolNames = activeToolsChanged ? processInputStepResult.activeTools : currentStep.tools ? Object.keys(currentStep.tools) : void 0;
|
|
12829
|
+
if (toolNames !== void 0) {
|
|
12830
|
+
agentSpan.update({
|
|
12831
|
+
attributes: {
|
|
12832
|
+
availableTools: toolNames
|
|
12833
|
+
}
|
|
12834
|
+
});
|
|
12835
|
+
}
|
|
12836
|
+
}
|
|
12837
|
+
}
|
|
12808
12838
|
if (processInputStepResult.tools && currentStep.tools) {
|
|
12809
12839
|
const convertedTools = {};
|
|
12810
12840
|
for (const [name, tool2] of Object.entries(currentStep.tools)) {
|
|
12811
12841
|
if (chunkK4NN2KQQ_cjs.isMastraTool(tool2)) {
|
|
12812
|
-
convertedTools[name] =
|
|
12842
|
+
convertedTools[name] = chunk64565EZF_cjs.makeCoreTool(
|
|
12813
12843
|
tool2,
|
|
12814
12844
|
{
|
|
12815
12845
|
name,
|
|
@@ -12946,7 +12976,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
12946
12976
|
}
|
|
12947
12977
|
}
|
|
12948
12978
|
if (isSupportedLanguageModel(currentStep.model)) {
|
|
12949
|
-
modelResult =
|
|
12979
|
+
modelResult = chunkB6D4D2CY_cjs.executeWithContextSync({
|
|
12950
12980
|
span: modelSpanTracker?.getTracingContext()?.currentSpan,
|
|
12951
12981
|
fn: () => execute({
|
|
12952
12982
|
runId,
|
|
@@ -13016,7 +13046,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
13016
13046
|
}
|
|
13017
13047
|
});
|
|
13018
13048
|
let transportResolver;
|
|
13019
|
-
if (currentStep.model instanceof
|
|
13049
|
+
if (currentStep.model instanceof chunkT5XU5TAV_cjs.ModelRouterLanguageModel) {
|
|
13020
13050
|
const routerModel = currentStep.model;
|
|
13021
13051
|
transportResolver = () => routerModel._getStreamTransport();
|
|
13022
13052
|
}
|
|
@@ -13179,7 +13209,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
13179
13209
|
finishReason: immediateFinishReason,
|
|
13180
13210
|
toolCalls: toolCallInfos.length > 0 ? toolCallInfos : void 0,
|
|
13181
13211
|
text: immediateText,
|
|
13182
|
-
...
|
|
13212
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext(outputStepTracingContext),
|
|
13183
13213
|
requestContext,
|
|
13184
13214
|
retryCount: currentRetryCount,
|
|
13185
13215
|
writer: processorWriter
|
|
@@ -13294,7 +13324,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
13294
13324
|
agentName: "LLMMappingStep",
|
|
13295
13325
|
processorStates: rest.processorStates
|
|
13296
13326
|
}) : void 0;
|
|
13297
|
-
const observabilityContext =
|
|
13327
|
+
const observabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
13298
13328
|
const streamWriter = rest.outputWriter ? { custom: async (data) => rest.outputWriter(data) } : void 0;
|
|
13299
13329
|
async function processAndEnqueueChunk(chunk) {
|
|
13300
13330
|
if (processorRunner && rest.processorStates) {
|
|
@@ -14369,12 +14399,12 @@ function workflowLoopStream({
|
|
|
14369
14399
|
}
|
|
14370
14400
|
const executionResult = resumeContext ? await run.resume({
|
|
14371
14401
|
resumeData: resumeContext.resumeData,
|
|
14372
|
-
...
|
|
14402
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
14373
14403
|
requestContext,
|
|
14374
14404
|
label: toolCallId
|
|
14375
14405
|
}) : await run.start({
|
|
14376
14406
|
inputData: initialData,
|
|
14377
|
-
...
|
|
14407
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
14378
14408
|
requestContext
|
|
14379
14409
|
});
|
|
14380
14410
|
if (executionResult.status !== "success") {
|
|
@@ -14518,7 +14548,7 @@ function loop({
|
|
|
14518
14548
|
}
|
|
14519
14549
|
const baseStream = workflowLoopStream(workflowLoopProps);
|
|
14520
14550
|
const stream = rest.modelSpanTracker?.wrapStream(baseStream) ?? baseStream;
|
|
14521
|
-
const observabilityContext =
|
|
14551
|
+
const observabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
14522
14552
|
modelOutput = new MastraModelOutput({
|
|
14523
14553
|
model: {
|
|
14524
14554
|
modelId: firstModel.model.modelId,
|
|
@@ -14651,7 +14681,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
14651
14681
|
workspace,
|
|
14652
14682
|
...rest
|
|
14653
14683
|
}) {
|
|
14654
|
-
const observabilityContext =
|
|
14684
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
14655
14685
|
let stopWhenToUse;
|
|
14656
14686
|
if (maxSteps && typeof maxSteps === "number") {
|
|
14657
14687
|
stopWhenToUse = chunkY3APFUXZ_cjs.stepCountIs(maxSteps);
|
|
@@ -14763,7 +14793,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
14763
14793
|
const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
|
|
14764
14794
|
if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
|
|
14765
14795
|
this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
|
|
14766
|
-
await
|
|
14796
|
+
await chunk64565EZF_cjs.delay(10 * 1e3);
|
|
14767
14797
|
}
|
|
14768
14798
|
},
|
|
14769
14799
|
onFinish: async (props) => {
|
|
@@ -15001,7 +15031,7 @@ async function prepareMemoryStep({
|
|
|
15001
15031
|
memoryConfig,
|
|
15002
15032
|
...rest
|
|
15003
15033
|
}) {
|
|
15004
|
-
const observabilityContext =
|
|
15034
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
15005
15035
|
const memory = await routingAgent.getMemory({ requestContext });
|
|
15006
15036
|
let thread = await memory?.getThreadById({ threadId });
|
|
15007
15037
|
if (!thread) {
|
|
@@ -15103,7 +15133,7 @@ async function saveMessagesWithProcessors(memory, messages, processorRunner, con
|
|
|
15103
15133
|
const { requestContext, ...observabilityContext } = context ?? {};
|
|
15104
15134
|
await processorRunner.runOutputProcessors(
|
|
15105
15135
|
messageList,
|
|
15106
|
-
|
|
15136
|
+
chunkB6D4D2CY_cjs.resolveObservabilityContext(observabilityContext),
|
|
15107
15137
|
requestContext
|
|
15108
15138
|
);
|
|
15109
15139
|
const processedMessages = messageList.get.response.db();
|
|
@@ -16254,7 +16284,7 @@ async function createNetworkLoop({
|
|
|
16254
16284
|
memory,
|
|
16255
16285
|
context: inputDataToUse,
|
|
16256
16286
|
// TODO: Pass proper tracing context when network supports tracing
|
|
16257
|
-
...
|
|
16287
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: void 0 }),
|
|
16258
16288
|
writer
|
|
16259
16289
|
},
|
|
16260
16290
|
{ toolCallId, messages: [] }
|
|
@@ -16542,7 +16572,7 @@ async function networkLoop({
|
|
|
16542
16572
|
requestContext,
|
|
16543
16573
|
messageList,
|
|
16544
16574
|
agentId: routingAgent.id,
|
|
16545
|
-
...
|
|
16575
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
16546
16576
|
structuredOutput: {
|
|
16547
16577
|
schema: v4.z.object({
|
|
16548
16578
|
resumeData: v4.z.string()
|
|
@@ -16920,7 +16950,7 @@ async function networkLoop({
|
|
|
16920
16950
|
messages,
|
|
16921
16951
|
routingAgent,
|
|
16922
16952
|
generateId: generateId2,
|
|
16923
|
-
...
|
|
16953
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
16924
16954
|
memoryConfig: routingAgentMemoryOptions?.options
|
|
16925
16955
|
});
|
|
16926
16956
|
return new MastraAgentNetworkStream({
|
|
@@ -17129,16 +17159,16 @@ var AgentLegacyHandler = class {
|
|
|
17129
17159
|
tracingOptions,
|
|
17130
17160
|
...rest
|
|
17131
17161
|
}) {
|
|
17132
|
-
const observabilityContext =
|
|
17162
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
17133
17163
|
return {
|
|
17134
17164
|
before: async () => {
|
|
17135
17165
|
if (process.env.NODE_ENV !== "test") {
|
|
17136
17166
|
this.capabilities.logger.debug(`[Agents:${this.capabilities.name}] - Starting generation`, { runId });
|
|
17137
17167
|
}
|
|
17138
|
-
const agentSpan =
|
|
17168
|
+
const agentSpan = chunkB6D4D2CY_cjs.getOrCreateSpan({
|
|
17139
17169
|
type: "agent_run" /* AGENT_RUN */,
|
|
17140
17170
|
name: `agent run: '${this.capabilities.id}'`,
|
|
17141
|
-
entityType:
|
|
17171
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.AGENT,
|
|
17142
17172
|
entityId: this.capabilities.id,
|
|
17143
17173
|
entityName: this.capabilities.name,
|
|
17144
17174
|
input: {
|
|
@@ -17162,7 +17192,7 @@ var AgentLegacyHandler = class {
|
|
|
17162
17192
|
requestContext,
|
|
17163
17193
|
mastra: this.capabilities.mastra
|
|
17164
17194
|
});
|
|
17165
|
-
const innerObservabilityContext =
|
|
17195
|
+
const innerObservabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17166
17196
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
17167
17197
|
const toolEnhancements = [
|
|
17168
17198
|
// toolsets
|
|
@@ -17409,7 +17439,7 @@ var AgentLegacyHandler = class {
|
|
|
17409
17439
|
instructions: titleInstructions
|
|
17410
17440
|
} = this.capabilities.resolveTitleGenerationConfig(config?.generateTitle);
|
|
17411
17441
|
if (shouldGenerate && !thread2.title && userMessage) {
|
|
17412
|
-
const observabilityContext2 =
|
|
17442
|
+
const observabilityContext2 = chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17413
17443
|
promises.push(
|
|
17414
17444
|
this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
|
|
17415
17445
|
if (title) {
|
|
@@ -17479,7 +17509,7 @@ var AgentLegacyHandler = class {
|
|
|
17479
17509
|
overrideScorers,
|
|
17480
17510
|
threadId,
|
|
17481
17511
|
resourceId,
|
|
17482
|
-
...
|
|
17512
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan })
|
|
17483
17513
|
});
|
|
17484
17514
|
const scoringData = {
|
|
17485
17515
|
input: {
|
|
@@ -17563,7 +17593,7 @@ var AgentLegacyHandler = class {
|
|
|
17563
17593
|
writableStream,
|
|
17564
17594
|
methodType,
|
|
17565
17595
|
tracingOptions,
|
|
17566
|
-
...
|
|
17596
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(args)
|
|
17567
17597
|
});
|
|
17568
17598
|
let messageList;
|
|
17569
17599
|
let thread;
|
|
@@ -17728,7 +17758,7 @@ var AgentLegacyHandler = class {
|
|
|
17728
17758
|
return tripwireResult;
|
|
17729
17759
|
}
|
|
17730
17760
|
const { experimental_output, output, agentSpan, ...llmOptions } = beforeResult;
|
|
17731
|
-
const observabilityContext =
|
|
17761
|
+
const observabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
17732
17762
|
let finalOutputProcessors = mergedGenerateOptions.outputProcessors;
|
|
17733
17763
|
if (!output || experimental_output) {
|
|
17734
17764
|
const result2 = await llmToUse.__text({
|
|
@@ -18016,7 +18046,7 @@ var AgentLegacyHandler = class {
|
|
|
18016
18046
|
}
|
|
18017
18047
|
const { onFinish, runId, output, experimental_output, agentSpan, messageList, requestContext, ...llmOptions } = beforeResult;
|
|
18018
18048
|
const overrideScorers = mergedStreamOptions.scorers;
|
|
18019
|
-
const observabilityContext =
|
|
18049
|
+
const observabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
18020
18050
|
if (!output || experimental_output) {
|
|
18021
18051
|
this.capabilities.logger.debug(`Starting agent ${this.capabilities.name} llm stream call`, {
|
|
18022
18052
|
runId
|
|
@@ -18342,7 +18372,7 @@ function createMapResultsStep({
|
|
|
18342
18372
|
const modelOutput = await getModelOutputForTripwire({
|
|
18343
18373
|
tripwire: memoryData.tripwire,
|
|
18344
18374
|
runId,
|
|
18345
|
-
...
|
|
18375
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
18346
18376
|
options,
|
|
18347
18377
|
model: agentModel,
|
|
18348
18378
|
messageList: memoryData.messageList
|
|
@@ -18396,7 +18426,7 @@ function createMapResultsStep({
|
|
|
18396
18426
|
methodType: modelMethodType,
|
|
18397
18427
|
agentId,
|
|
18398
18428
|
requestContext: result.requestContext,
|
|
18399
|
-
...
|
|
18429
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
18400
18430
|
runId,
|
|
18401
18431
|
toolChoice: result.toolChoice,
|
|
18402
18432
|
tools: result.tools,
|
|
@@ -18541,14 +18571,15 @@ function createPrepareMemoryStep({
|
|
|
18541
18571
|
requestContext,
|
|
18542
18572
|
instructions,
|
|
18543
18573
|
memoryConfig,
|
|
18544
|
-
memory
|
|
18574
|
+
memory,
|
|
18575
|
+
isResume
|
|
18545
18576
|
}) {
|
|
18546
18577
|
return createStep({
|
|
18547
18578
|
id: "prepare-memory-step",
|
|
18548
18579
|
inputSchema: v4.z.object({}),
|
|
18549
18580
|
outputSchema: prepareMemoryStepOutputSchema,
|
|
18550
18581
|
execute: async ({ ...rest }) => {
|
|
18551
|
-
const observabilityContext =
|
|
18582
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
18552
18583
|
const thread = threadFromArgs;
|
|
18553
18584
|
const messageList = new chunkANLO4VM2_cjs.MessageList({
|
|
18554
18585
|
threadId: thread?.id,
|
|
@@ -18564,13 +18595,16 @@ function createPrepareMemoryStep({
|
|
|
18564
18595
|
addSystemMessage(messageList, options.system, "user-provided");
|
|
18565
18596
|
if (!memory || !thread?.id && !resourceId) {
|
|
18566
18597
|
messageList.add(options.messages, "input");
|
|
18567
|
-
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18598
|
+
let tripwire2;
|
|
18599
|
+
if (!isResume) {
|
|
18600
|
+
({ tripwire: tripwire2 } = await capabilities.runInputProcessors({
|
|
18601
|
+
requestContext,
|
|
18602
|
+
...observabilityContext,
|
|
18603
|
+
messageList,
|
|
18604
|
+
inputProcessorOverrides: options.inputProcessors,
|
|
18605
|
+
processorStates
|
|
18606
|
+
}));
|
|
18607
|
+
}
|
|
18574
18608
|
return {
|
|
18575
18609
|
threadExists: false,
|
|
18576
18610
|
thread: void 0,
|
|
@@ -18632,13 +18666,16 @@ function createPrepareMemoryStep({
|
|
|
18632
18666
|
memoryConfig
|
|
18633
18667
|
});
|
|
18634
18668
|
messageList.add(options.messages, "input");
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18669
|
+
let tripwire;
|
|
18670
|
+
if (!isResume) {
|
|
18671
|
+
({ tripwire } = await capabilities.runInputProcessors({
|
|
18672
|
+
requestContext,
|
|
18673
|
+
...observabilityContext,
|
|
18674
|
+
messageList,
|
|
18675
|
+
inputProcessorOverrides: options.inputProcessors,
|
|
18676
|
+
processorStates
|
|
18677
|
+
}));
|
|
18678
|
+
}
|
|
18642
18679
|
return {
|
|
18643
18680
|
thread: threadObject,
|
|
18644
18681
|
messageList,
|
|
@@ -18684,7 +18721,7 @@ function createPrepareToolsStep({
|
|
|
18684
18721
|
resourceId,
|
|
18685
18722
|
runId,
|
|
18686
18723
|
requestContext,
|
|
18687
|
-
...
|
|
18724
|
+
...chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
18688
18725
|
outputWriter: options.outputWriter,
|
|
18689
18726
|
methodType,
|
|
18690
18727
|
memoryConfig: options.memory?.options,
|
|
@@ -18741,7 +18778,7 @@ function createStreamStep({
|
|
|
18741
18778
|
...validatedInputData,
|
|
18742
18779
|
outputProcessors: processors,
|
|
18743
18780
|
returnScorerData,
|
|
18744
|
-
...
|
|
18781
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(observabilityContext),
|
|
18745
18782
|
requireToolApproval,
|
|
18746
18783
|
toolCallConcurrency,
|
|
18747
18784
|
resumeContext,
|
|
@@ -18808,7 +18845,8 @@ function createPrepareStreamWorkflow({
|
|
|
18808
18845
|
requestContext,
|
|
18809
18846
|
instructions,
|
|
18810
18847
|
memoryConfig,
|
|
18811
|
-
memory
|
|
18848
|
+
memory,
|
|
18849
|
+
isResume: !!resumeContext
|
|
18812
18850
|
});
|
|
18813
18851
|
const streamStep = createStreamStep({
|
|
18814
18852
|
capabilities,
|
|
@@ -19188,7 +19226,9 @@ ${errorMessages}`,
|
|
|
19188
19226
|
* @internal
|
|
19189
19227
|
*/
|
|
19190
19228
|
async listResolvedOutputProcessors(requestContext, configuredProcessorOverrides) {
|
|
19191
|
-
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#outputProcessors ? typeof this.#outputProcessors === "function" ? await this.#outputProcessors({
|
|
19229
|
+
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#outputProcessors ? typeof this.#outputProcessors === "function" ? await this.#outputProcessors({
|
|
19230
|
+
requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext()
|
|
19231
|
+
}) : this.#outputProcessors : [];
|
|
19192
19232
|
const memory = await this.getMemory({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() });
|
|
19193
19233
|
const memoryProcessors = memory ? await memory.getOutputProcessors(configuredProcessors, requestContext) : [];
|
|
19194
19234
|
const allProcessors = [...configuredProcessors, ...memoryProcessors];
|
|
@@ -19200,7 +19240,9 @@ ${errorMessages}`,
|
|
|
19200
19240
|
* @internal
|
|
19201
19241
|
*/
|
|
19202
19242
|
async listResolvedInputProcessors(requestContext, configuredProcessorOverrides) {
|
|
19203
|
-
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#inputProcessors ? typeof this.#inputProcessors === "function" ? await this.#inputProcessors({
|
|
19243
|
+
const configuredProcessors = configuredProcessorOverrides ? configuredProcessorOverrides : this.#inputProcessors ? typeof this.#inputProcessors === "function" ? await this.#inputProcessors({
|
|
19244
|
+
requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext()
|
|
19245
|
+
}) : this.#inputProcessors : [];
|
|
19204
19246
|
const memory = await this.getMemory({ requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext() });
|
|
19205
19247
|
const memoryProcessors = memory ? await memory.getInputProcessors(configuredProcessors, requestContext) : [];
|
|
19206
19248
|
const workspaceProcessors = await this.getWorkspaceInstructionsProcessors(configuredProcessors, requestContext);
|
|
@@ -19261,7 +19303,9 @@ ${errorMessages}`,
|
|
|
19261
19303
|
*/
|
|
19262
19304
|
async listConfiguredInputProcessors(requestContext) {
|
|
19263
19305
|
if (!this.#inputProcessors) return [];
|
|
19264
|
-
const configuredProcessors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({
|
|
19306
|
+
const configuredProcessors = typeof this.#inputProcessors === "function" ? await this.#inputProcessors({
|
|
19307
|
+
requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext()
|
|
19308
|
+
}) : this.#inputProcessors;
|
|
19265
19309
|
return configuredProcessors;
|
|
19266
19310
|
}
|
|
19267
19311
|
/**
|
|
@@ -19273,7 +19317,9 @@ ${errorMessages}`,
|
|
|
19273
19317
|
*/
|
|
19274
19318
|
async listConfiguredOutputProcessors(requestContext) {
|
|
19275
19319
|
if (!this.#outputProcessors) return [];
|
|
19276
|
-
const configuredProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({
|
|
19320
|
+
const configuredProcessors = typeof this.#outputProcessors === "function" ? await this.#outputProcessors({
|
|
19321
|
+
requestContext: requestContext || new chunk5WBEMKE2_cjs.RequestContext()
|
|
19322
|
+
}) : this.#outputProcessors;
|
|
19277
19323
|
return configuredProcessors;
|
|
19278
19324
|
}
|
|
19279
19325
|
/**
|
|
@@ -19355,7 +19401,10 @@ ${errorMessages}`,
|
|
|
19355
19401
|
if (typeof this.#memory !== "function") {
|
|
19356
19402
|
resolvedMemory = this.#memory;
|
|
19357
19403
|
} else {
|
|
19358
|
-
const result = this.#memory({
|
|
19404
|
+
const result = this.#memory({
|
|
19405
|
+
requestContext,
|
|
19406
|
+
mastra: this.#mastra
|
|
19407
|
+
});
|
|
19359
19408
|
resolvedMemory = await Promise.resolve(result);
|
|
19360
19409
|
if (!resolvedMemory) {
|
|
19361
19410
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -19416,7 +19465,10 @@ ${errorMessages}`,
|
|
|
19416
19465
|
if (typeof this.#workspace !== "function") {
|
|
19417
19466
|
return this.#workspace;
|
|
19418
19467
|
}
|
|
19419
|
-
const result = this.#workspace({
|
|
19468
|
+
const result = this.#workspace({
|
|
19469
|
+
requestContext,
|
|
19470
|
+
mastra: this.#mastra
|
|
19471
|
+
});
|
|
19420
19472
|
const resolvedWorkspace = await Promise.resolve(result);
|
|
19421
19473
|
if (!resolvedWorkspace) {
|
|
19422
19474
|
return void 0;
|
|
@@ -19472,7 +19524,9 @@ ${errorMessages}`,
|
|
|
19472
19524
|
} = {}) {
|
|
19473
19525
|
let workflowRecord;
|
|
19474
19526
|
if (typeof this.#workflows === "function") {
|
|
19475
|
-
workflowRecord = await Promise.resolve(
|
|
19527
|
+
workflowRecord = await Promise.resolve(
|
|
19528
|
+
this.#workflows({ requestContext, mastra: this.#mastra })
|
|
19529
|
+
);
|
|
19476
19530
|
} else {
|
|
19477
19531
|
workflowRecord = this.#workflows ?? {};
|
|
19478
19532
|
}
|
|
@@ -19489,7 +19543,10 @@ ${errorMessages}`,
|
|
|
19489
19543
|
if (typeof this.#scorers !== "function") {
|
|
19490
19544
|
return this.#scorers;
|
|
19491
19545
|
}
|
|
19492
|
-
const result = this.#scorers({
|
|
19546
|
+
const result = this.#scorers({
|
|
19547
|
+
requestContext,
|
|
19548
|
+
mastra: this.#mastra
|
|
19549
|
+
});
|
|
19493
19550
|
return resolveMaybePromise(result, (scorers) => {
|
|
19494
19551
|
if (!scorers) {
|
|
19495
19552
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -19650,7 +19707,10 @@ ${errorMessages}`,
|
|
|
19650
19707
|
if (typeof this.#defaultGenerateOptionsLegacy !== "function") {
|
|
19651
19708
|
return this.#defaultGenerateOptionsLegacy;
|
|
19652
19709
|
}
|
|
19653
|
-
const result = this.#defaultGenerateOptionsLegacy({
|
|
19710
|
+
const result = this.#defaultGenerateOptionsLegacy({
|
|
19711
|
+
requestContext,
|
|
19712
|
+
mastra: this.#mastra
|
|
19713
|
+
});
|
|
19654
19714
|
return resolveMaybePromise(result, (options) => {
|
|
19655
19715
|
if (!options) {
|
|
19656
19716
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -19685,7 +19745,10 @@ ${errorMessages}`,
|
|
|
19685
19745
|
if (typeof this.#defaultStreamOptionsLegacy !== "function") {
|
|
19686
19746
|
return this.#defaultStreamOptionsLegacy;
|
|
19687
19747
|
}
|
|
19688
|
-
const result = this.#defaultStreamOptionsLegacy({
|
|
19748
|
+
const result = this.#defaultStreamOptionsLegacy({
|
|
19749
|
+
requestContext,
|
|
19750
|
+
mastra: this.#mastra
|
|
19751
|
+
});
|
|
19689
19752
|
return resolveMaybePromise(result, (options) => {
|
|
19690
19753
|
if (!options) {
|
|
19691
19754
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -19718,7 +19781,10 @@ ${errorMessages}`,
|
|
|
19718
19781
|
if (typeof this.#defaultOptions !== "function") {
|
|
19719
19782
|
return this.#defaultOptions;
|
|
19720
19783
|
}
|
|
19721
|
-
const result = this.#defaultOptions({
|
|
19784
|
+
const result = this.#defaultOptions({
|
|
19785
|
+
requestContext,
|
|
19786
|
+
mastra: this.#mastra
|
|
19787
|
+
});
|
|
19722
19788
|
return resolveMaybePromise(result, (options) => {
|
|
19723
19789
|
if (!options) {
|
|
19724
19790
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -19754,7 +19820,10 @@ ${errorMessages}`,
|
|
|
19754
19820
|
if (typeof this.#defaultNetworkOptions !== "function") {
|
|
19755
19821
|
return this.#defaultNetworkOptions;
|
|
19756
19822
|
}
|
|
19757
|
-
const result = this.#defaultNetworkOptions({
|
|
19823
|
+
const result = this.#defaultNetworkOptions({
|
|
19824
|
+
requestContext,
|
|
19825
|
+
mastra: this.#mastra
|
|
19826
|
+
});
|
|
19758
19827
|
return resolveMaybePromise(result, (options) => {
|
|
19759
19828
|
if (!options) {
|
|
19760
19829
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -19785,7 +19854,7 @@ ${errorMessages}`,
|
|
|
19785
19854
|
*/
|
|
19786
19855
|
listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
|
|
19787
19856
|
if (typeof this.#tools !== "function") {
|
|
19788
|
-
return
|
|
19857
|
+
return chunk64565EZF_cjs.ensureToolProperties(this.#tools);
|
|
19789
19858
|
}
|
|
19790
19859
|
const result = this.#tools({
|
|
19791
19860
|
requestContext,
|
|
@@ -19806,7 +19875,7 @@ ${errorMessages}`,
|
|
|
19806
19875
|
this.logger.error(mastraError.toString());
|
|
19807
19876
|
throw mastraError;
|
|
19808
19877
|
}
|
|
19809
|
-
return
|
|
19878
|
+
return chunk64565EZF_cjs.ensureToolProperties(tools);
|
|
19810
19879
|
});
|
|
19811
19880
|
}
|
|
19812
19881
|
/**
|
|
@@ -19824,7 +19893,10 @@ ${errorMessages}`,
|
|
|
19824
19893
|
requestContext = new chunk5WBEMKE2_cjs.RequestContext(),
|
|
19825
19894
|
model
|
|
19826
19895
|
} = {}) {
|
|
19827
|
-
const modelSelectionPromise = model ? this.resolveModelSelection(
|
|
19896
|
+
const modelSelectionPromise = model ? this.resolveModelSelection(
|
|
19897
|
+
model,
|
|
19898
|
+
requestContext
|
|
19899
|
+
) : this.resolveModelSelection(this.model, requestContext);
|
|
19828
19900
|
return modelSelectionPromise.then((modelSelection) => {
|
|
19829
19901
|
const firstEnabledModel = Array.isArray(modelSelection) ? modelSelection.find((m) => m.enabled)?.model : modelSelection;
|
|
19830
19902
|
if (!firstEnabledModel) {
|
|
@@ -19852,7 +19924,7 @@ ${errorMessages}`,
|
|
|
19852
19924
|
});
|
|
19853
19925
|
});
|
|
19854
19926
|
} else {
|
|
19855
|
-
llm = new
|
|
19927
|
+
llm = new chunkOXS5X7PW_cjs.MastraLLMV1({
|
|
19856
19928
|
model: modelInfo,
|
|
19857
19929
|
mastra: this.#mastra,
|
|
19858
19930
|
options: { tracingPolicy: this.#options?.tracingPolicy }
|
|
@@ -19878,7 +19950,7 @@ ${errorMessages}`,
|
|
|
19878
19950
|
*/
|
|
19879
19951
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
19880
19952
|
try {
|
|
19881
|
-
return await
|
|
19953
|
+
return await chunkT5XU5TAV_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
19882
19954
|
} catch (error) {
|
|
19883
19955
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
19884
19956
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -19950,7 +20022,10 @@ ${errorMessages}`,
|
|
|
19950
20022
|
*/
|
|
19951
20023
|
async resolveModelSelection(modelConfig, requestContext) {
|
|
19952
20024
|
if (typeof modelConfig === "function") {
|
|
19953
|
-
const resolved = await modelConfig({
|
|
20025
|
+
const resolved = await modelConfig({
|
|
20026
|
+
requestContext,
|
|
20027
|
+
mastra: this.#mastra
|
|
20028
|
+
});
|
|
19954
20029
|
if (Array.isArray(resolved)) {
|
|
19955
20030
|
if (resolved.length === 0) {
|
|
19956
20031
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -20204,7 +20279,7 @@ ${errorMessages}`,
|
|
|
20204
20279
|
instructions,
|
|
20205
20280
|
...rest
|
|
20206
20281
|
}) {
|
|
20207
|
-
const observabilityContext =
|
|
20282
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20208
20283
|
const llm = await this.getLLM({ requestContext, model });
|
|
20209
20284
|
const normMessage = new chunkANLO4VM2_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
|
|
20210
20285
|
if (!normMessage) {
|
|
@@ -20327,7 +20402,7 @@ ${errorMessages}`,
|
|
|
20327
20402
|
autoResumeSuspendedTools,
|
|
20328
20403
|
...rest
|
|
20329
20404
|
}) {
|
|
20330
|
-
const observabilityContext =
|
|
20405
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20331
20406
|
let convertedMemoryTools = {};
|
|
20332
20407
|
if (this._agentNetworkAppend) {
|
|
20333
20408
|
this.logger.debug(`[Agent:${this.name}] - Skipping memory tools (agent network context)`, { runId });
|
|
@@ -20364,7 +20439,7 @@ ${errorMessages}`,
|
|
|
20364
20439
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20365
20440
|
requireApproval: toolObj.requireApproval
|
|
20366
20441
|
};
|
|
20367
|
-
const convertedToCoreTool =
|
|
20442
|
+
const convertedToCoreTool = chunk64565EZF_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20368
20443
|
convertedMemoryTools[toolName] = convertedToCoreTool;
|
|
20369
20444
|
}
|
|
20370
20445
|
}
|
|
@@ -20383,7 +20458,7 @@ ${errorMessages}`,
|
|
|
20383
20458
|
autoResumeSuspendedTools,
|
|
20384
20459
|
...rest
|
|
20385
20460
|
}) {
|
|
20386
|
-
const observabilityContext =
|
|
20461
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20387
20462
|
let convertedWorkspaceTools = {};
|
|
20388
20463
|
if (this._agentNetworkAppend) {
|
|
20389
20464
|
this.logger.debug(`[Agent:${this.name}] - Skipping workspace tools (agent network context)`, { runId });
|
|
@@ -20416,7 +20491,7 @@ ${errorMessages}`,
|
|
|
20416
20491
|
requireApproval: toolObj.requireApproval,
|
|
20417
20492
|
workspace
|
|
20418
20493
|
};
|
|
20419
|
-
const convertedToCoreTool =
|
|
20494
|
+
const convertedToCoreTool = chunk64565EZF_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20420
20495
|
convertedWorkspaceTools[toolName] = convertedToCoreTool;
|
|
20421
20496
|
}
|
|
20422
20497
|
}
|
|
@@ -20438,7 +20513,7 @@ ${errorMessages}`,
|
|
|
20438
20513
|
autoResumeSuspendedTools,
|
|
20439
20514
|
...rest
|
|
20440
20515
|
}) {
|
|
20441
|
-
const observabilityContext =
|
|
20516
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20442
20517
|
let convertedSkillTools = {};
|
|
20443
20518
|
if (this._agentNetworkAppend) {
|
|
20444
20519
|
return convertedSkillTools;
|
|
@@ -20471,7 +20546,7 @@ ${errorMessages}`,
|
|
|
20471
20546
|
// Skill tools never require approval
|
|
20472
20547
|
workspace
|
|
20473
20548
|
};
|
|
20474
|
-
const convertedToCoreTool =
|
|
20549
|
+
const convertedToCoreTool = chunk64565EZF_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
|
|
20475
20550
|
convertedSkillTools[toolName] = convertedToCoreTool;
|
|
20476
20551
|
}
|
|
20477
20552
|
}
|
|
@@ -20531,7 +20606,7 @@ ${errorMessages}`,
|
|
|
20531
20606
|
*/
|
|
20532
20607
|
async __runProcessInputStep(args) {
|
|
20533
20608
|
const { requestContext, messageList, stepNumber = 0, processorStates, ...rest } = args;
|
|
20534
|
-
const observabilityContext =
|
|
20609
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20535
20610
|
let tripwire;
|
|
20536
20611
|
if (this.#inputProcessors || this.#memory) {
|
|
20537
20612
|
const runner = await this.getProcessorRunner({
|
|
@@ -20660,7 +20735,7 @@ ${errorMessages}`,
|
|
|
20660
20735
|
autoResumeSuspendedTools,
|
|
20661
20736
|
...rest
|
|
20662
20737
|
}) {
|
|
20663
|
-
const observabilityContext =
|
|
20738
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20664
20739
|
let toolsForRequest = {};
|
|
20665
20740
|
this.logger.debug(`[Agents:${this.name}] - Assembling assigned tools`, { runId, threadId, resourceId });
|
|
20666
20741
|
const memory = await this.getMemory({ requestContext });
|
|
@@ -20688,7 +20763,7 @@ ${errorMessages}`,
|
|
|
20688
20763
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20689
20764
|
requireApproval: tool2.requireApproval
|
|
20690
20765
|
};
|
|
20691
|
-
return [k,
|
|
20766
|
+
return [k, chunk64565EZF_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
|
|
20692
20767
|
})
|
|
20693
20768
|
);
|
|
20694
20769
|
const assignedToolEntriesConverted = Object.fromEntries(
|
|
@@ -20713,7 +20788,7 @@ ${errorMessages}`,
|
|
|
20713
20788
|
autoResumeSuspendedTools,
|
|
20714
20789
|
...rest
|
|
20715
20790
|
}) {
|
|
20716
|
-
const observabilityContext =
|
|
20791
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20717
20792
|
let toolsForRequest = {};
|
|
20718
20793
|
const memory = await this.getMemory({ requestContext });
|
|
20719
20794
|
const toolsFromToolsets = Object.values(toolsets || {});
|
|
@@ -20740,7 +20815,7 @@ ${errorMessages}`,
|
|
|
20740
20815
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20741
20816
|
requireApproval: toolObj.requireApproval
|
|
20742
20817
|
};
|
|
20743
|
-
const convertedToCoreTool =
|
|
20818
|
+
const convertedToCoreTool = chunk64565EZF_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
|
|
20744
20819
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20745
20820
|
}
|
|
20746
20821
|
}
|
|
@@ -20761,7 +20836,7 @@ ${errorMessages}`,
|
|
|
20761
20836
|
autoResumeSuspendedTools,
|
|
20762
20837
|
...rest
|
|
20763
20838
|
}) {
|
|
20764
|
-
const observabilityContext =
|
|
20839
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20765
20840
|
let toolsForRequest = {};
|
|
20766
20841
|
const memory = await this.getMemory({ requestContext });
|
|
20767
20842
|
const clientToolsForInput = Object.entries(clientTools || {});
|
|
@@ -20787,7 +20862,7 @@ ${errorMessages}`,
|
|
|
20787
20862
|
tracingPolicy: this.#options?.tracingPolicy,
|
|
20788
20863
|
requireApproval: tool2.requireApproval
|
|
20789
20864
|
};
|
|
20790
|
-
const convertedToCoreTool =
|
|
20865
|
+
const convertedToCoreTool = chunk64565EZF_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
|
|
20791
20866
|
toolsForRequest[toolName] = convertedToCoreTool;
|
|
20792
20867
|
}
|
|
20793
20868
|
}
|
|
@@ -20839,7 +20914,7 @@ ${errorMessages}`,
|
|
|
20839
20914
|
delegation,
|
|
20840
20915
|
...rest
|
|
20841
20916
|
}) {
|
|
20842
|
-
const observabilityContext =
|
|
20917
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
20843
20918
|
const convertedAgentTools = {};
|
|
20844
20919
|
const agents = await this.listAgents({ requestContext });
|
|
20845
20920
|
if (Object.keys(agents).length > 0) {
|
|
@@ -21069,7 +21144,7 @@ ${effectiveInstructions}`;
|
|
|
21069
21144
|
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
21070
21145
|
runId: suspendedToolRunId,
|
|
21071
21146
|
requestContext,
|
|
21072
|
-
...
|
|
21147
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {}),
|
|
21073
21148
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21074
21149
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21075
21150
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
@@ -21081,7 +21156,7 @@ ${effectiveInstructions}`;
|
|
|
21081
21156
|
} : {}
|
|
21082
21157
|
}) : await agent.generate(messagesForSubAgent, {
|
|
21083
21158
|
requestContext,
|
|
21084
|
-
...
|
|
21159
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {}),
|
|
21085
21160
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21086
21161
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21087
21162
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
@@ -21145,14 +21220,14 @@ ${effectiveInstructions}`;
|
|
|
21145
21220
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
21146
21221
|
const generateResult = await agent.generateLegacy(messagesForSubAgent, {
|
|
21147
21222
|
requestContext,
|
|
21148
|
-
...
|
|
21223
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {})
|
|
21149
21224
|
});
|
|
21150
21225
|
result = { text: generateResult.text };
|
|
21151
21226
|
} else if ((methodType === "stream" || methodType === "streamLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
21152
21227
|
const streamResult = resumeData ? await agent.resumeStream(resumeData, {
|
|
21153
21228
|
runId: suspendedToolRunId,
|
|
21154
21229
|
requestContext,
|
|
21155
|
-
...
|
|
21230
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {}),
|
|
21156
21231
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21157
21232
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21158
21233
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
@@ -21166,7 +21241,7 @@ ${effectiveInstructions}`;
|
|
|
21166
21241
|
} : {}
|
|
21167
21242
|
}) : await agent.stream(messagesForSubAgent, {
|
|
21168
21243
|
requestContext,
|
|
21169
|
-
...
|
|
21244
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {}),
|
|
21170
21245
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
21171
21246
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
21172
21247
|
...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
|
|
@@ -21179,7 +21254,6 @@ ${effectiveInstructions}`;
|
|
|
21179
21254
|
}
|
|
21180
21255
|
} : {}
|
|
21181
21256
|
});
|
|
21182
|
-
let fullText = "";
|
|
21183
21257
|
let requireToolApproval;
|
|
21184
21258
|
let suspendedPayload;
|
|
21185
21259
|
let resumeSchema;
|
|
@@ -21207,9 +21281,6 @@ ${effectiveInstructions}`;
|
|
|
21207
21281
|
}
|
|
21208
21282
|
}
|
|
21209
21283
|
}
|
|
21210
|
-
if (chunk.type === "text-delta") {
|
|
21211
|
-
fullText += chunk.payload.text;
|
|
21212
|
-
}
|
|
21213
21284
|
}
|
|
21214
21285
|
const subAgentToolResults = (await streamResult.toolResults)?.map((toolResult) => ({
|
|
21215
21286
|
toolName: toolResult.payload.toolName,
|
|
@@ -21261,11 +21332,17 @@ ${effectiveInstructions}`;
|
|
|
21261
21332
|
isAgentSuspend: true
|
|
21262
21333
|
});
|
|
21263
21334
|
}
|
|
21264
|
-
|
|
21335
|
+
const processedText = await streamResult.text;
|
|
21336
|
+
result = {
|
|
21337
|
+
text: processedText,
|
|
21338
|
+
subAgentThreadId,
|
|
21339
|
+
subAgentResourceId,
|
|
21340
|
+
subAgentToolResults
|
|
21341
|
+
};
|
|
21265
21342
|
} else {
|
|
21266
21343
|
const streamResult = await agent.streamLegacy(effectivePrompt, {
|
|
21267
21344
|
requestContext,
|
|
21268
|
-
...
|
|
21345
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {})
|
|
21269
21346
|
});
|
|
21270
21347
|
let fullText = "";
|
|
21271
21348
|
for await (const chunk of streamResult.fullStream) {
|
|
@@ -21448,7 +21525,7 @@ ${effectiveInstructions}`;
|
|
|
21448
21525
|
...observabilityContext,
|
|
21449
21526
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21450
21527
|
};
|
|
21451
|
-
convertedAgentTools[`agent-${agentName}`] =
|
|
21528
|
+
convertedAgentTools[`agent-${agentName}`] = chunk64565EZF_cjs.makeCoreTool(
|
|
21452
21529
|
toolObj,
|
|
21453
21530
|
options,
|
|
21454
21531
|
void 0,
|
|
@@ -21471,7 +21548,7 @@ ${effectiveInstructions}`;
|
|
|
21471
21548
|
autoResumeSuspendedTools,
|
|
21472
21549
|
...rest
|
|
21473
21550
|
}) {
|
|
21474
|
-
const observabilityContext =
|
|
21551
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
21475
21552
|
const convertedWorkflowTools = {};
|
|
21476
21553
|
const workflows = await this.listWorkflows({ requestContext });
|
|
21477
21554
|
if (Object.keys(workflows).length > 0) {
|
|
@@ -21542,13 +21619,13 @@ ${effectiveInstructions}`;
|
|
|
21542
21619
|
result = await run.resume({
|
|
21543
21620
|
resumeData,
|
|
21544
21621
|
requestContext,
|
|
21545
|
-
...
|
|
21622
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {})
|
|
21546
21623
|
});
|
|
21547
21624
|
} else {
|
|
21548
21625
|
result = await run.start({
|
|
21549
21626
|
inputData: workflowInputData,
|
|
21550
21627
|
requestContext,
|
|
21551
|
-
...
|
|
21628
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {}),
|
|
21552
21629
|
...initialState && { initialState }
|
|
21553
21630
|
});
|
|
21554
21631
|
}
|
|
@@ -21556,7 +21633,7 @@ ${effectiveInstructions}`;
|
|
|
21556
21633
|
const streamResult = run.streamLegacy({
|
|
21557
21634
|
inputData: workflowInputData,
|
|
21558
21635
|
requestContext,
|
|
21559
|
-
...
|
|
21636
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {})
|
|
21560
21637
|
});
|
|
21561
21638
|
if (context?.writer) {
|
|
21562
21639
|
await streamResult.stream.pipeTo(context.writer);
|
|
@@ -21569,11 +21646,11 @@ ${effectiveInstructions}`;
|
|
|
21569
21646
|
const streamResult = resumeData ? run.resumeStream({
|
|
21570
21647
|
resumeData,
|
|
21571
21648
|
requestContext,
|
|
21572
|
-
...
|
|
21649
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {})
|
|
21573
21650
|
}) : run.stream({
|
|
21574
21651
|
inputData: workflowInputData,
|
|
21575
21652
|
requestContext,
|
|
21576
|
-
...
|
|
21653
|
+
...chunkB6D4D2CY_cjs.resolveObservabilityContext(context ?? {}),
|
|
21577
21654
|
...initialState && { initialState }
|
|
21578
21655
|
});
|
|
21579
21656
|
if (context?.writer) {
|
|
@@ -21665,7 +21742,7 @@ ${effectiveInstructions}`;
|
|
|
21665
21742
|
...observabilityContext,
|
|
21666
21743
|
tracingPolicy: this.#options?.tracingPolicy
|
|
21667
21744
|
};
|
|
21668
|
-
convertedWorkflowTools[`workflow-${workflowName}`] =
|
|
21745
|
+
convertedWorkflowTools[`workflow-${workflowName}`] = chunk64565EZF_cjs.makeCoreTool(
|
|
21669
21746
|
toolObj,
|
|
21670
21747
|
options,
|
|
21671
21748
|
void 0,
|
|
@@ -21693,11 +21770,11 @@ ${effectiveInstructions}`;
|
|
|
21693
21770
|
delegation,
|
|
21694
21771
|
...rest
|
|
21695
21772
|
}) {
|
|
21696
|
-
const observabilityContext =
|
|
21773
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
21697
21774
|
let mastraProxy = void 0;
|
|
21698
21775
|
const logger = this.logger;
|
|
21699
21776
|
if (this.#mastra) {
|
|
21700
|
-
mastraProxy =
|
|
21777
|
+
mastraProxy = chunk64565EZF_cjs.createMastraProxy({ mastra: this.#mastra, logger });
|
|
21701
21778
|
}
|
|
21702
21779
|
const assignedTools = await this.listAssignedTools({
|
|
21703
21780
|
runId,
|
|
@@ -21949,7 +22026,7 @@ ${effectiveInstructions}`;
|
|
|
21949
22026
|
const resolvedModel = await this.resolveModelConfig(selection, requestContext);
|
|
21950
22027
|
this.assertSupportsPreparedModels(resolvedModel);
|
|
21951
22028
|
let headers;
|
|
21952
|
-
if (resolvedModel instanceof
|
|
22029
|
+
if (resolvedModel instanceof chunkT5XU5TAV_cjs.ModelRouterLanguageModel) {
|
|
21953
22030
|
headers = resolvedModel.config?.headers;
|
|
21954
22031
|
}
|
|
21955
22032
|
return [
|
|
@@ -21982,7 +22059,7 @@ ${effectiveInstructions}`;
|
|
|
21982
22059
|
throw mastraError;
|
|
21983
22060
|
}
|
|
21984
22061
|
let headers;
|
|
21985
|
-
if (model instanceof
|
|
22062
|
+
if (model instanceof chunkT5XU5TAV_cjs.ModelRouterLanguageModel) {
|
|
21986
22063
|
headers = model.config?.headers;
|
|
21987
22064
|
}
|
|
21988
22065
|
return {
|
|
@@ -22052,10 +22129,10 @@ ${effectiveInstructions}`;
|
|
|
22052
22129
|
resourceId
|
|
22053
22130
|
}) || crypto2.randomUUID();
|
|
22054
22131
|
const instructions = options.instructions || await this.getInstructions({ requestContext });
|
|
22055
|
-
const agentSpan =
|
|
22132
|
+
const agentSpan = chunkB6D4D2CY_cjs.getOrCreateSpan({
|
|
22056
22133
|
type: "agent_run" /* AGENT_RUN */,
|
|
22057
22134
|
name: `agent run: '${this.id}'`,
|
|
22058
|
-
entityType:
|
|
22135
|
+
entityType: chunkB6D4D2CY_cjs.EntityType.AGENT,
|
|
22059
22136
|
entityId: this.id,
|
|
22060
22137
|
entityName: this.name,
|
|
22061
22138
|
input: options.messages,
|
|
@@ -22128,7 +22205,7 @@ ${effectiveInstructions}`;
|
|
|
22128
22205
|
workspace
|
|
22129
22206
|
});
|
|
22130
22207
|
const run = await executionWorkflow.createRun();
|
|
22131
|
-
const observabilityContext =
|
|
22208
|
+
const observabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
22132
22209
|
const result = await run.start({ ...observabilityContext });
|
|
22133
22210
|
return result;
|
|
22134
22211
|
}
|
|
@@ -22152,7 +22229,7 @@ ${effectiveInstructions}`;
|
|
|
22152
22229
|
structuredOutput = false,
|
|
22153
22230
|
overrideScorers
|
|
22154
22231
|
}) {
|
|
22155
|
-
const observabilityContext =
|
|
22232
|
+
const observabilityContext = chunkB6D4D2CY_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
22156
22233
|
const resToLog = {
|
|
22157
22234
|
text: result.text,
|
|
22158
22235
|
object: result.object,
|
|
@@ -22216,26 +22293,28 @@ ${effectiveInstructions}`;
|
|
|
22216
22293
|
shouldGenerate,
|
|
22217
22294
|
model: titleModel,
|
|
22218
22295
|
instructions: titleInstructions
|
|
22219
|
-
} = this.resolveTitleGenerationConfig(
|
|
22296
|
+
} = this.resolveTitleGenerationConfig(
|
|
22297
|
+
config.generateTitle
|
|
22298
|
+
);
|
|
22220
22299
|
if (shouldGenerate && !thread.title) {
|
|
22221
22300
|
const userMessage = this.getMostRecentUserMessage(messageList.get.all.ui());
|
|
22222
22301
|
if (userMessage) {
|
|
22223
|
-
|
|
22224
|
-
|
|
22225
|
-
|
|
22226
|
-
|
|
22227
|
-
|
|
22228
|
-
|
|
22302
|
+
void this.genTitle(userMessage, requestContext, observabilityContext, titleModel, titleInstructions).then(
|
|
22303
|
+
async (title) => {
|
|
22304
|
+
if (title) {
|
|
22305
|
+
await memory.createThread({
|
|
22306
|
+
threadId: thread.id,
|
|
22307
|
+
resourceId,
|
|
22308
|
+
memoryConfig,
|
|
22309
|
+
title,
|
|
22310
|
+
metadata: thread.metadata
|
|
22311
|
+
});
|
|
22312
|
+
}
|
|
22313
|
+
},
|
|
22314
|
+
(error) => {
|
|
22315
|
+
this.logger.error("Error persisting generated title:", error);
|
|
22316
|
+
}
|
|
22229
22317
|
);
|
|
22230
|
-
if (title) {
|
|
22231
|
-
await memory.createThread({
|
|
22232
|
-
threadId: thread.id,
|
|
22233
|
-
resourceId,
|
|
22234
|
-
memoryConfig,
|
|
22235
|
-
title,
|
|
22236
|
-
metadata: thread.metadata
|
|
22237
|
-
});
|
|
22238
|
-
}
|
|
22239
22318
|
}
|
|
22240
22319
|
}
|
|
22241
22320
|
} catch (e) {
|
|
@@ -22433,7 +22512,7 @@ ${effectiveInstructions}`;
|
|
|
22433
22512
|
const defaultOptions = await this.getDefaultOptions({
|
|
22434
22513
|
requestContext: options?.requestContext
|
|
22435
22514
|
});
|
|
22436
|
-
const mergedOptions =
|
|
22515
|
+
const mergedOptions = chunk64565EZF_cjs.deepMerge(
|
|
22437
22516
|
defaultOptions,
|
|
22438
22517
|
options ?? {}
|
|
22439
22518
|
);
|
|
@@ -22503,7 +22582,7 @@ ${effectiveInstructions}`;
|
|
|
22503
22582
|
const defaultOptions = await this.getDefaultOptions({
|
|
22504
22583
|
requestContext: streamOptions?.requestContext
|
|
22505
22584
|
});
|
|
22506
|
-
const mergedOptions =
|
|
22585
|
+
const mergedOptions = chunk64565EZF_cjs.deepMerge(
|
|
22507
22586
|
defaultOptions,
|
|
22508
22587
|
streamOptions ?? {}
|
|
22509
22588
|
);
|
|
@@ -22567,7 +22646,7 @@ ${effectiveInstructions}`;
|
|
|
22567
22646
|
const defaultOptions = await this.getDefaultOptions({
|
|
22568
22647
|
requestContext: streamOptions?.requestContext
|
|
22569
22648
|
});
|
|
22570
|
-
let mergedStreamOptions =
|
|
22649
|
+
let mergedStreamOptions = chunk64565EZF_cjs.deepMerge(
|
|
22571
22650
|
defaultOptions,
|
|
22572
22651
|
streamOptions ?? {}
|
|
22573
22652
|
);
|
|
@@ -22632,7 +22711,7 @@ ${effectiveInstructions}`;
|
|
|
22632
22711
|
const defaultOptions = await this.getDefaultOptions({
|
|
22633
22712
|
requestContext: options?.requestContext
|
|
22634
22713
|
});
|
|
22635
|
-
const mergedOptions =
|
|
22714
|
+
const mergedOptions = chunk64565EZF_cjs.deepMerge(
|
|
22636
22715
|
defaultOptions,
|
|
22637
22716
|
options ?? {}
|
|
22638
22717
|
);
|
|
@@ -22869,7 +22948,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
22869
22948
|
async processInput(args) {
|
|
22870
22949
|
try {
|
|
22871
22950
|
const { messages, abort, ...rest } = args;
|
|
22872
|
-
const observabilityContext =
|
|
22951
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
22873
22952
|
if (messages.length === 0) {
|
|
22874
22953
|
return messages;
|
|
22875
22954
|
}
|
|
@@ -22903,7 +22982,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
22903
22982
|
async processOutputStream(args) {
|
|
22904
22983
|
try {
|
|
22905
22984
|
const { part, streamParts, abort, ...rest } = args;
|
|
22906
|
-
const observabilityContext =
|
|
22985
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
22907
22986
|
if (part.type !== "text-delta") {
|
|
22908
22987
|
return part;
|
|
22909
22988
|
}
|
|
@@ -23111,7 +23190,7 @@ var PromptInjectionDetector = class _PromptInjectionDetector {
|
|
|
23111
23190
|
async processInput(args) {
|
|
23112
23191
|
try {
|
|
23113
23192
|
const { messages, abort, ...rest } = args;
|
|
23114
|
-
const observabilityContext =
|
|
23193
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
23115
23194
|
if (messages.length === 0) {
|
|
23116
23195
|
return messages;
|
|
23117
23196
|
}
|
|
@@ -23359,7 +23438,7 @@ var PIIDetector = class _PIIDetector {
|
|
|
23359
23438
|
async processInput(args) {
|
|
23360
23439
|
try {
|
|
23361
23440
|
const { messages, abort, ...rest } = args;
|
|
23362
|
-
const observabilityContext =
|
|
23441
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
23363
23442
|
if (messages.length === 0) {
|
|
23364
23443
|
return messages;
|
|
23365
23444
|
}
|
|
@@ -23642,7 +23721,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
23642
23721
|
*/
|
|
23643
23722
|
async processOutputStream(args) {
|
|
23644
23723
|
const { part, abort, ...rest } = args;
|
|
23645
|
-
const observabilityContext =
|
|
23724
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
23646
23725
|
try {
|
|
23647
23726
|
if (part.type !== "text-delta") {
|
|
23648
23727
|
return part;
|
|
@@ -23705,7 +23784,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
23705
23784
|
abort,
|
|
23706
23785
|
...rest
|
|
23707
23786
|
}) {
|
|
23708
|
-
const observabilityContext =
|
|
23787
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
23709
23788
|
try {
|
|
23710
23789
|
if (messages.length === 0) {
|
|
23711
23790
|
return messages;
|
|
@@ -23834,7 +23913,7 @@ var LanguageDetector = class _LanguageDetector {
|
|
|
23834
23913
|
async processInput(args) {
|
|
23835
23914
|
try {
|
|
23836
23915
|
const { messages, abort, ...rest } = args;
|
|
23837
|
-
const observabilityContext =
|
|
23916
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
23838
23917
|
if (messages.length === 0) {
|
|
23839
23918
|
return messages;
|
|
23840
23919
|
}
|
|
@@ -24499,7 +24578,7 @@ var SystemPromptScrubber = class {
|
|
|
24499
24578
|
*/
|
|
24500
24579
|
async processOutputStream(args) {
|
|
24501
24580
|
const { part, abort, ...rest } = args;
|
|
24502
|
-
const observabilityContext =
|
|
24581
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
24503
24582
|
if (part.type !== "text-delta") {
|
|
24504
24583
|
return part;
|
|
24505
24584
|
}
|
|
@@ -24554,7 +24633,7 @@ var SystemPromptScrubber = class {
|
|
|
24554
24633
|
abort,
|
|
24555
24634
|
...rest
|
|
24556
24635
|
}) {
|
|
24557
|
-
const observabilityContext =
|
|
24636
|
+
const observabilityContext = chunkB6D4D2CY_cjs.resolveObservabilityContext(rest);
|
|
24558
24637
|
const processedMessages = [];
|
|
24559
24638
|
for (const message of messages) {
|
|
24560
24639
|
if (message.role !== "assistant" || !message.content?.parts) {
|
|
@@ -24911,6 +24990,20 @@ function getMessageText(message) {
|
|
|
24911
24990
|
function getReminderMarkup(reminderText, instructionPath) {
|
|
24912
24991
|
return `<system-reminder type="${REMINDER_TYPE}" path="${escapeXmlAttribute(instructionPath)}">${escapeXml(reminderText)}</system-reminder>`;
|
|
24913
24992
|
}
|
|
24993
|
+
function truncateToTokenLimit(content, maxTokens) {
|
|
24994
|
+
const estimatedTokens = tokenx.estimateTokenCount(content);
|
|
24995
|
+
if (estimatedTokens <= maxTokens) {
|
|
24996
|
+
return content;
|
|
24997
|
+
}
|
|
24998
|
+
const approximateCharLimit = Math.max(maxTokens * 4, 1);
|
|
24999
|
+
const sliceEnd = Math.min(content.length, approximateCharLimit);
|
|
25000
|
+
const newlineIndex = content.lastIndexOf("\n", sliceEnd);
|
|
25001
|
+
const truncatedContent = content.slice(0, newlineIndex > 0 ? newlineIndex : sliceEnd).trimEnd();
|
|
25002
|
+
const shownTokens = tokenx.estimateTokenCount(truncatedContent);
|
|
25003
|
+
return `${truncatedContent}
|
|
25004
|
+
|
|
25005
|
+
[truncated \u2014 showing first ~${shownTokens} of ~${estimatedTokens} estimated tokens]`;
|
|
25006
|
+
}
|
|
24914
25007
|
function getCompletedToolCalls(messageList) {
|
|
24915
25008
|
const completed = [];
|
|
24916
25009
|
for (const message of messageList.get.all.db()) {
|
|
@@ -24954,12 +25047,14 @@ var AgentsMDInjector = class {
|
|
|
24954
25047
|
description = "Injects AGENTS.md reminders when instruction file operations are detected";
|
|
24955
25048
|
processorIndex = 0;
|
|
24956
25049
|
reminderText;
|
|
25050
|
+
maxTokens;
|
|
24957
25051
|
pathExists;
|
|
24958
25052
|
isDirectory;
|
|
24959
25053
|
readFile;
|
|
24960
25054
|
getIgnoredInstructionPaths;
|
|
24961
25055
|
constructor(options) {
|
|
24962
25056
|
this.reminderText = options.reminderText;
|
|
25057
|
+
this.maxTokens = options.maxTokens ?? 1e3;
|
|
24963
25058
|
this.pathExists = options.pathExists ?? fs.existsSync;
|
|
24964
25059
|
this.isDirectory = options.isDirectory ?? ((path) => {
|
|
24965
25060
|
try {
|
|
@@ -25007,7 +25102,7 @@ var AgentsMDInjector = class {
|
|
|
25007
25102
|
try {
|
|
25008
25103
|
const content = this.readFile(instructionPath).trim();
|
|
25009
25104
|
if (content.length > 0) {
|
|
25010
|
-
return content;
|
|
25105
|
+
return truncateToTokenLimit(content, this.maxTokens);
|
|
25011
25106
|
}
|
|
25012
25107
|
} catch {
|
|
25013
25108
|
}
|
|
@@ -25867,7 +25962,7 @@ var WorkingMemory = class {
|
|
|
25867
25962
|
return messageList;
|
|
25868
25963
|
}
|
|
25869
25964
|
generateEmptyFromSchemaInternal(schema) {
|
|
25870
|
-
const result =
|
|
25965
|
+
const result = chunk64565EZF_cjs.generateEmptyFromSchema(schema);
|
|
25871
25966
|
return Object.keys(result).length > 0 ? result : null;
|
|
25872
25967
|
}
|
|
25873
25968
|
getWorkingMemoryToolInstruction({
|
|
@@ -26512,13 +26607,27 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
26512
26607
|
);
|
|
26513
26608
|
}
|
|
26514
26609
|
if (typeof config.embedder === "string") {
|
|
26515
|
-
this.embedder = new
|
|
26610
|
+
this.embedder = new chunkT5XU5TAV_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
26516
26611
|
} else {
|
|
26517
26612
|
this.embedder = config.embedder;
|
|
26518
26613
|
}
|
|
26519
26614
|
if (config.embedderOptions) {
|
|
26520
26615
|
this.embedderOptions = config.embedderOptions;
|
|
26521
26616
|
}
|
|
26617
|
+
} else {
|
|
26618
|
+
if (config.vector) {
|
|
26619
|
+
this.vector = config.vector;
|
|
26620
|
+
}
|
|
26621
|
+
if (config.embedder) {
|
|
26622
|
+
if (typeof config.embedder === "string") {
|
|
26623
|
+
this.embedder = new chunkT5XU5TAV_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
26624
|
+
} else {
|
|
26625
|
+
this.embedder = config.embedder;
|
|
26626
|
+
}
|
|
26627
|
+
}
|
|
26628
|
+
if (config.embedderOptions) {
|
|
26629
|
+
this.embedderOptions = config.embedderOptions;
|
|
26630
|
+
}
|
|
26522
26631
|
}
|
|
26523
26632
|
}
|
|
26524
26633
|
/**
|
|
@@ -26551,7 +26660,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
26551
26660
|
}
|
|
26552
26661
|
setEmbedder(embedder, embedderOptions) {
|
|
26553
26662
|
if (typeof embedder === "string") {
|
|
26554
|
-
this.embedder = new
|
|
26663
|
+
this.embedder = new chunkT5XU5TAV_cjs.ModelRouterEmbeddingModel(embedder);
|
|
26555
26664
|
} else {
|
|
26556
26665
|
this.embedder = embedder;
|
|
26557
26666
|
}
|
|
@@ -26648,7 +26757,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
26648
26757
|
"The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
|
|
26649
26758
|
);
|
|
26650
26759
|
}
|
|
26651
|
-
const mergedConfig =
|
|
26760
|
+
const mergedConfig = chunk64565EZF_cjs.deepMerge(this.threadConfig, config || {});
|
|
26652
26761
|
if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
|
|
26653
26762
|
mergedConfig.workingMemory.schema = config.workingMemory.schema;
|
|
26654
26763
|
}
|
|
@@ -27000,7 +27109,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
27000
27109
|
} = {}) {
|
|
27001
27110
|
super({
|
|
27002
27111
|
name: "mock",
|
|
27003
|
-
storage: storage || new
|
|
27112
|
+
storage: storage || new chunkX36INADV_cjs.InMemoryStore(),
|
|
27004
27113
|
options: {
|
|
27005
27114
|
...options,
|
|
27006
27115
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : options?.workingMemory,
|
|
@@ -27311,5 +27420,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
27311
27420
|
exports.validateStepResumeData = validateStepResumeData;
|
|
27312
27421
|
exports.validateStepStateData = validateStepStateData;
|
|
27313
27422
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
27314
|
-
//# sourceMappingURL=chunk-
|
|
27315
|
-
//# sourceMappingURL=chunk-
|
|
27423
|
+
//# sourceMappingURL=chunk-4K2NKQGN.cjs.map
|
|
27424
|
+
//# sourceMappingURL=chunk-4K2NKQGN.cjs.map
|