@mastra/core 1.11.0-alpha.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +336 -0
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/conversion/output-converter.d.ts.map +1 -1
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/{chunk-2CSKXHM7.cjs → chunk-6NZQ52RZ.cjs} +22 -10
- package/dist/chunk-6NZQ52RZ.cjs.map +1 -0
- package/dist/{chunk-7P77FWM6.js → chunk-7FVJIJGY.js} +3 -3
- package/dist/{chunk-7P77FWM6.js.map → chunk-7FVJIJGY.js.map} +1 -1
- package/dist/{chunk-MIAFERSL.js → chunk-7UM6FE6A.js} +8 -2
- package/dist/chunk-7UM6FE6A.js.map +1 -0
- package/dist/{chunk-CDXZJ3PO.cjs → chunk-E7PW4ZAB.cjs} +8 -2
- package/dist/chunk-E7PW4ZAB.cjs.map +1 -0
- package/dist/{chunk-L7NBGABG.cjs → chunk-FIQRYC7M.cjs} +4 -4
- package/dist/{chunk-L7NBGABG.cjs.map → chunk-FIQRYC7M.cjs.map} +1 -1
- package/dist/{chunk-V5SM5A4F.cjs → chunk-FN6ZOGJ7.cjs} +6 -6
- package/dist/{chunk-V5SM5A4F.cjs.map → chunk-FN6ZOGJ7.cjs.map} +1 -1
- package/dist/{chunk-RH5O4YBE.cjs → chunk-NJVIJQ4R.cjs} +3 -3
- package/dist/{chunk-RH5O4YBE.cjs.map → chunk-NJVIJQ4R.cjs.map} +1 -1
- package/dist/{chunk-PUTCRAH6.cjs → chunk-QAIBZ7GH.cjs} +235 -230
- package/dist/{chunk-PUTCRAH6.cjs.map → chunk-QAIBZ7GH.cjs.map} +1 -1
- package/dist/{chunk-JNNKF6W5.cjs → chunk-QGT2HJGX.cjs} +24 -24
- package/dist/{chunk-JNNKF6W5.cjs.map → chunk-QGT2HJGX.cjs.map} +1 -1
- package/dist/{chunk-J4V2WVFG.js → chunk-RF2EPUM4.js} +3 -3
- package/dist/{chunk-J4V2WVFG.js.map → chunk-RF2EPUM4.js.map} +1 -1
- package/dist/{chunk-C574TBOV.js → chunk-S5BMBKUR.js} +20 -15
- package/dist/{chunk-C574TBOV.js.map → chunk-S5BMBKUR.js.map} +1 -1
- package/dist/{chunk-XWMBFPD5.js → chunk-VW4MYD6N.js} +3 -3
- package/dist/{chunk-XWMBFPD5.js.map → chunk-VW4MYD6N.js.map} +1 -1
- package/dist/{chunk-WLS37KH3.js → chunk-W3LSSG4T.js} +3 -3
- package/dist/{chunk-WLS37KH3.js.map → chunk-W3LSSG4T.js.map} +1 -1
- package/dist/{chunk-GQRY6HEY.js → chunk-WD467XGW.js} +22 -10
- package/dist/chunk-WD467XGW.js.map +1 -0
- package/dist/{chunk-QYYWWS3U.cjs → chunk-YTND5227.cjs} +2 -2
- package/dist/chunk-YTND5227.cjs.map +1 -0
- package/dist/{chunk-5FNG2ISL.js → chunk-YY3T5AJK.js} +2 -2
- package/dist/chunk-YY3T5AJK.js.map +1 -0
- package/dist/datasets/index.cjs +16 -16
- package/dist/datasets/index.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +320 -320
- package/dist/docs/references/reference-observability-tracing-interfaces.md +3 -0
- package/dist/evals/index.cjs +19 -19
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +7 -7
- package/dist/evals/scoreTraces/index.js +3 -3
- package/dist/harness/index.cjs +16 -16
- package/dist/harness/index.js +6 -6
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +12 -12
- package/dist/llm/index.js +3 -3
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/netlify-BFMLDQM5.js +3 -0
- package/dist/{netlify-QDVWIV7X.js.map → netlify-BFMLDQM5.js.map} +1 -1
- package/dist/netlify-RN36CL4F.cjs +12 -0
- package/dist/{netlify-OZA4BKIK.cjs.map → netlify-RN36CL4F.cjs.map} +1 -1
- package/dist/observability/index.cjs +17 -17
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +2 -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 +42 -42
- package/dist/processors/index.js +1 -1
- package/dist/provider-registry-6FITK73S.js +3 -0
- package/dist/{provider-registry-L3ZZWLYW.js.map → provider-registry-6FITK73S.js.map} +1 -1
- package/dist/provider-registry-IHJW2WNI.cjs +40 -0
- package/dist/{provider-registry-TLYLLTKR.cjs.map → provider-registry-IHJW2WNI.cjs.map} +1 -1
- 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 +172 -172
- package/dist/storage/index.js +2 -2
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- package/dist/test-utils/llm-mock.cjs +12 -12
- package/dist/test-utils/llm-mock.js +3 -3
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tools/index.cjs +6 -6
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool.d.ts +6 -1
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +15 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +9 -9
- package/dist/vector/index.js +2 -2
- 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/dist/workspace/index.cjs +67 -67
- package/dist/workspace/index.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-2CSKXHM7.cjs.map +0 -1
- package/dist/chunk-5FNG2ISL.js.map +0 -1
- package/dist/chunk-CDXZJ3PO.cjs.map +0 -1
- package/dist/chunk-GQRY6HEY.js.map +0 -1
- package/dist/chunk-MIAFERSL.js.map +0 -1
- package/dist/chunk-QYYWWS3U.cjs.map +0 -1
- package/dist/netlify-OZA4BKIK.cjs +0 -12
- package/dist/netlify-QDVWIV7X.js +0 -3
- package/dist/provider-registry-L3ZZWLYW.js +0 -3
- package/dist/provider-registry-TLYLLTKR.cjs +0 -40
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkCWLK5FXA_cjs = require('./chunk-CWLK5FXA.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkNJVIJQ4R_cjs = require('./chunk-NJVIJQ4R.cjs');
|
|
5
5
|
var chunkKK2U4Z7X_cjs = require('./chunk-KK2U4Z7X.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunkFIQRYC7M_cjs = require('./chunk-FIQRYC7M.cjs');
|
|
7
|
+
var chunk6NZQ52RZ_cjs = require('./chunk-6NZQ52RZ.cjs');
|
|
8
8
|
var chunkBOV4GMU4_cjs = require('./chunk-BOV4GMU4.cjs');
|
|
9
9
|
var chunkTYXLVOEC_cjs = require('./chunk-TYXLVOEC.cjs');
|
|
10
10
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunkQGT2HJGX_cjs = require('./chunk-QGT2HJGX.cjs');
|
|
12
|
+
var chunkFN6ZOGJ7_cjs = require('./chunk-FN6ZOGJ7.cjs');
|
|
13
|
+
var chunkYTND5227_cjs = require('./chunk-YTND5227.cjs');
|
|
14
|
+
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
13
15
|
var chunkT3PXTC5Y_cjs = require('./chunk-T3PXTC5Y.cjs');
|
|
14
|
-
var
|
|
16
|
+
var chunkE7PW4ZAB_cjs = require('./chunk-E7PW4ZAB.cjs');
|
|
15
17
|
var chunkRLPRSIR2_cjs = require('./chunk-RLPRSIR2.cjs');
|
|
16
|
-
var chunkQYYWWS3U_cjs = require('./chunk-QYYWWS3U.cjs');
|
|
17
18
|
var chunkVWJ7H3MJ_cjs = require('./chunk-VWJ7H3MJ.cjs');
|
|
18
|
-
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
19
19
|
var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
|
|
20
|
-
var chunk2VD5OGOT_cjs = require('./chunk-2VD5OGOT.cjs');
|
|
21
20
|
var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
|
|
22
21
|
var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
|
|
23
22
|
var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
|
|
23
|
+
var chunk2VD5OGOT_cjs = require('./chunk-2VD5OGOT.cjs');
|
|
24
24
|
var chunkRO47SMI7_cjs = require('./chunk-RO47SMI7.cjs');
|
|
25
25
|
var chunk7XAECHYL_cjs = require('./chunk-7XAECHYL.cjs');
|
|
26
26
|
var chunkBVWXTWXP_cjs = require('./chunk-BVWXTWXP.cjs');
|
|
@@ -703,7 +703,7 @@ var StructuredOutputProcessor = class {
|
|
|
703
703
|
}
|
|
704
704
|
async processOutputStream(args) {
|
|
705
705
|
const { part, state, streamParts, abort, ...rest } = args;
|
|
706
|
-
const observabilityContext =
|
|
706
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
707
707
|
const controller = state.controller;
|
|
708
708
|
switch (part.type) {
|
|
709
709
|
case "finish":
|
|
@@ -8349,9 +8349,9 @@ function stableHeaderKey(headers) {
|
|
|
8349
8349
|
return JSON.stringify(entries.sort(([a], [b]) => a.localeCompare(b)));
|
|
8350
8350
|
}
|
|
8351
8351
|
function getStaticProvidersByGateway(name14) {
|
|
8352
|
-
return Object.fromEntries(Object.entries(
|
|
8352
|
+
return Object.fromEntries(Object.entries(chunkFIQRYC7M_cjs.PROVIDER_REGISTRY).filter(([_provider, config]) => config.gateway === name14));
|
|
8353
8353
|
}
|
|
8354
|
-
var defaultGateways = [new
|
|
8354
|
+
var defaultGateways = [new chunkNJVIJQ4R_cjs.NetlifyGateway(), new chunkCWLK5FXA_cjs.ModelsDevGateway(getStaticProvidersByGateway(`models.dev`))];
|
|
8355
8355
|
var ModelRouterLanguageModel = class _ModelRouterLanguageModel {
|
|
8356
8356
|
specificationVersion = "v2";
|
|
8357
8357
|
defaultObjectGenerationMode = "json";
|
|
@@ -8750,7 +8750,7 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
8750
8750
|
...rest
|
|
8751
8751
|
}) {
|
|
8752
8752
|
const model = this.#model;
|
|
8753
|
-
const observabilityContext =
|
|
8753
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
8754
8754
|
this.logger.debug(`[LLM] - Generating text`, {
|
|
8755
8755
|
runId,
|
|
8756
8756
|
messages,
|
|
@@ -8865,14 +8865,14 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
8865
8865
|
await delay2(10 * 1e3);
|
|
8866
8866
|
}
|
|
8867
8867
|
},
|
|
8868
|
-
experimental_output: schema ?
|
|
8868
|
+
experimental_output: schema ? chunk6NZQ52RZ_cjs.output_exports.object({
|
|
8869
8869
|
schema
|
|
8870
8870
|
}) : void 0
|
|
8871
8871
|
};
|
|
8872
8872
|
try {
|
|
8873
|
-
const result = await
|
|
8873
|
+
const result = await chunkYTND5227_cjs.executeWithContext({
|
|
8874
8874
|
span: llmSpan,
|
|
8875
|
-
fn: () =>
|
|
8875
|
+
fn: () => chunk6NZQ52RZ_cjs.generateText(argsForExecute)
|
|
8876
8876
|
});
|
|
8877
8877
|
if (schema && result.finishReason === "stop") {
|
|
8878
8878
|
result.object = result.experimental_output;
|
|
@@ -8933,7 +8933,7 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
8933
8933
|
...rest
|
|
8934
8934
|
}) {
|
|
8935
8935
|
const model = this.#model;
|
|
8936
|
-
const observabilityContext =
|
|
8936
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
8937
8937
|
this.logger.debug(`[LLM] - Generating a text object`, { runId });
|
|
8938
8938
|
const llmSpan = observabilityContext.tracingContext.currentSpan?.createChildSpan({
|
|
8939
8939
|
name: `llm: '${model.modelId}'`,
|
|
@@ -8988,7 +8988,7 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
8988
8988
|
schema: processedSchema
|
|
8989
8989
|
};
|
|
8990
8990
|
try {
|
|
8991
|
-
const result = await
|
|
8991
|
+
const result = await chunk6NZQ52RZ_cjs.generateObject(argsForExecute);
|
|
8992
8992
|
llmSpan?.end({
|
|
8993
8993
|
output: {
|
|
8994
8994
|
object: result.object,
|
|
@@ -9076,7 +9076,7 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9076
9076
|
...rest
|
|
9077
9077
|
}) {
|
|
9078
9078
|
const model = this.#model;
|
|
9079
|
-
const observabilityContext =
|
|
9079
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
9080
9080
|
this.logger.debug(`[LLM] - Streaming text`, {
|
|
9081
9081
|
runId,
|
|
9082
9082
|
threadId,
|
|
@@ -9267,12 +9267,12 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9267
9267
|
},
|
|
9268
9268
|
...rest,
|
|
9269
9269
|
messages,
|
|
9270
|
-
experimental_output: schema ?
|
|
9270
|
+
experimental_output: schema ? chunk6NZQ52RZ_cjs.output_exports.object({
|
|
9271
9271
|
schema
|
|
9272
9272
|
}) : void 0
|
|
9273
9273
|
};
|
|
9274
9274
|
try {
|
|
9275
|
-
return
|
|
9275
|
+
return chunkYTND5227_cjs.executeWithContextSync({ span: llmSpan, fn: () => chunk6NZQ52RZ_cjs.streamText(argsForExecute) });
|
|
9276
9276
|
} catch (e) {
|
|
9277
9277
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError(
|
|
9278
9278
|
{
|
|
@@ -9312,7 +9312,7 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9312
9312
|
...rest
|
|
9313
9313
|
}) {
|
|
9314
9314
|
const model = this.#model;
|
|
9315
|
-
const observabilityContext =
|
|
9315
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
9316
9316
|
this.logger.debug(`[LLM] - Streaming structured output`, {
|
|
9317
9317
|
runId,
|
|
9318
9318
|
messages
|
|
@@ -9440,7 +9440,7 @@ var MastraLLMV1 = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
9440
9440
|
schema: processedSchema
|
|
9441
9441
|
};
|
|
9442
9442
|
try {
|
|
9443
|
-
return
|
|
9443
|
+
return chunk6NZQ52RZ_cjs.streamObject(argsForExecute);
|
|
9444
9444
|
} catch (e) {
|
|
9445
9445
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError(
|
|
9446
9446
|
{
|
|
@@ -9642,7 +9642,7 @@ var ModelRouterEmbeddingModel = class {
|
|
|
9642
9642
|
headers: normalizedConfig.headers
|
|
9643
9643
|
}).textEmbeddingModel(normalizedConfig.modelId);
|
|
9644
9644
|
} else {
|
|
9645
|
-
const registry =
|
|
9645
|
+
const registry = chunkFIQRYC7M_cjs.GatewayRegistry.getInstance();
|
|
9646
9646
|
const providerConfig = registry.getProviderConfig(normalizedConfig.providerId);
|
|
9647
9647
|
if (!providerConfig) {
|
|
9648
9648
|
throw new Error(`Unknown provider: ${normalizedConfig.providerId}`);
|
|
@@ -9835,7 +9835,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
9835
9835
|
async processInput(args) {
|
|
9836
9836
|
try {
|
|
9837
9837
|
const { messages, abort, ...rest } = args;
|
|
9838
|
-
const observabilityContext =
|
|
9838
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
9839
9839
|
if (messages.length === 0) {
|
|
9840
9840
|
return messages;
|
|
9841
9841
|
}
|
|
@@ -9869,7 +9869,7 @@ var ModerationProcessor = class _ModerationProcessor {
|
|
|
9869
9869
|
async processOutputStream(args) {
|
|
9870
9870
|
try {
|
|
9871
9871
|
const { part, streamParts, abort, ...rest } = args;
|
|
9872
|
-
const observabilityContext =
|
|
9872
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
9873
9873
|
if (part.type !== "text-delta") {
|
|
9874
9874
|
return part;
|
|
9875
9875
|
}
|
|
@@ -10077,7 +10077,7 @@ var PromptInjectionDetector = class _PromptInjectionDetector {
|
|
|
10077
10077
|
async processInput(args) {
|
|
10078
10078
|
try {
|
|
10079
10079
|
const { messages, abort, ...rest } = args;
|
|
10080
|
-
const observabilityContext =
|
|
10080
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
10081
10081
|
if (messages.length === 0) {
|
|
10082
10082
|
return messages;
|
|
10083
10083
|
}
|
|
@@ -10325,7 +10325,7 @@ var PIIDetector = class _PIIDetector {
|
|
|
10325
10325
|
async processInput(args) {
|
|
10326
10326
|
try {
|
|
10327
10327
|
const { messages, abort, ...rest } = args;
|
|
10328
|
-
const observabilityContext =
|
|
10328
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
10329
10329
|
if (messages.length === 0) {
|
|
10330
10330
|
return messages;
|
|
10331
10331
|
}
|
|
@@ -10608,7 +10608,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
10608
10608
|
*/
|
|
10609
10609
|
async processOutputStream(args) {
|
|
10610
10610
|
const { part, abort, ...rest } = args;
|
|
10611
|
-
const observabilityContext =
|
|
10611
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
10612
10612
|
try {
|
|
10613
10613
|
if (part.type !== "text-delta") {
|
|
10614
10614
|
return part;
|
|
@@ -10671,7 +10671,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
|
|
|
10671
10671
|
abort,
|
|
10672
10672
|
...rest
|
|
10673
10673
|
}) {
|
|
10674
|
-
const observabilityContext =
|
|
10674
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
10675
10675
|
try {
|
|
10676
10676
|
if (messages.length === 0) {
|
|
10677
10677
|
return messages;
|
|
@@ -10800,7 +10800,7 @@ var LanguageDetector = class _LanguageDetector {
|
|
|
10800
10800
|
async processInput(args) {
|
|
10801
10801
|
try {
|
|
10802
10802
|
const { messages, abort, ...rest } = args;
|
|
10803
|
-
const observabilityContext =
|
|
10803
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
10804
10804
|
if (messages.length === 0) {
|
|
10805
10805
|
return messages;
|
|
10806
10806
|
}
|
|
@@ -11449,7 +11449,7 @@ var SystemPromptScrubber = class {
|
|
|
11449
11449
|
*/
|
|
11450
11450
|
async processOutputStream(args) {
|
|
11451
11451
|
const { part, abort, ...rest } = args;
|
|
11452
|
-
const observabilityContext =
|
|
11452
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
11453
11453
|
if (part.type !== "text-delta") {
|
|
11454
11454
|
return part;
|
|
11455
11455
|
}
|
|
@@ -11504,7 +11504,7 @@ var SystemPromptScrubber = class {
|
|
|
11504
11504
|
abort,
|
|
11505
11505
|
...rest
|
|
11506
11506
|
}) {
|
|
11507
|
-
const observabilityContext =
|
|
11507
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
11508
11508
|
const processedMessages = [];
|
|
11509
11509
|
for (const message of messages) {
|
|
11510
11510
|
if (message.role !== "assistant" || !message.content?.parts) {
|
|
@@ -11841,7 +11841,7 @@ var ToolSearchProcessor = class {
|
|
|
11841
11841
|
minScore: options.search?.minScore ?? 0
|
|
11842
11842
|
};
|
|
11843
11843
|
this.ttl = options.ttl ?? 36e5;
|
|
11844
|
-
this.bm25Index = new
|
|
11844
|
+
this.bm25Index = new chunkQGT2HJGX_cjs.BM25Index({}, TOOL_SEARCH_TOKENIZE_OPTIONS);
|
|
11845
11845
|
this.indexTools();
|
|
11846
11846
|
if (this.ttl > 0) {
|
|
11847
11847
|
this.scheduleCleanup();
|
|
@@ -12006,7 +12006,7 @@ var ToolSearchProcessor = class {
|
|
|
12006
12006
|
messageList.addSystem(
|
|
12007
12007
|
"To discover available tools, call search_tools with a keyword query. To add a tool to the conversation, call load_tool with the tool name. Tools must be loaded before they can be used."
|
|
12008
12008
|
);
|
|
12009
|
-
const searchTool =
|
|
12009
|
+
const searchTool = chunkE7PW4ZAB_cjs.createTool({
|
|
12010
12010
|
id: "search_tools",
|
|
12011
12011
|
description: "Search for available tools by keyword. Use this when you need a capability you don't currently have. Returns a list of matching tools with their names and descriptions. After finding a useful tool, use load_tool to make it available.",
|
|
12012
12012
|
inputSchema: z37.z.object({
|
|
@@ -12036,7 +12036,7 @@ var ToolSearchProcessor = class {
|
|
|
12036
12036
|
};
|
|
12037
12037
|
}
|
|
12038
12038
|
});
|
|
12039
|
-
const loadTool =
|
|
12039
|
+
const loadTool = chunkE7PW4ZAB_cjs.createTool({
|
|
12040
12040
|
id: "load_tool",
|
|
12041
12041
|
description: "Load a specific tool into your context. Call this after finding a tool with search_tools. Once loaded, the tool will be available for use. Args: toolName - The exact name of the tool to load (from search results).",
|
|
12042
12042
|
inputSchema: z37.z.object({
|
|
@@ -14904,7 +14904,7 @@ function safelyParseJSON(input) {
|
|
|
14904
14904
|
}
|
|
14905
14905
|
function transformRow(row, tableName, options = {}) {
|
|
14906
14906
|
const { preferredTimestampFields = {}, convertTimestamps = false, nullValuePattern, fieldMappings = {} } = options;
|
|
14907
|
-
const tableSchema =
|
|
14907
|
+
const tableSchema = chunkFN6ZOGJ7_cjs.TABLE_SCHEMAS[tableName];
|
|
14908
14908
|
const result = {};
|
|
14909
14909
|
for (const [key, columnSchema] of Object.entries(tableSchema)) {
|
|
14910
14910
|
const sourceKey = fieldMappings[key] ?? key;
|
|
@@ -14935,7 +14935,7 @@ function transformRow(row, tableName, options = {}) {
|
|
|
14935
14935
|
return result;
|
|
14936
14936
|
}
|
|
14937
14937
|
function transformScoreRow(row, options = {}) {
|
|
14938
|
-
return transformRow(row,
|
|
14938
|
+
return transformRow(row, chunkFN6ZOGJ7_cjs.TABLE_SCORERS, options);
|
|
14939
14939
|
}
|
|
14940
14940
|
function toUpperSnakeCase(str) {
|
|
14941
14941
|
return str.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -15564,7 +15564,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
15564
15564
|
});
|
|
15565
15565
|
const total = messages.length;
|
|
15566
15566
|
const paginatedMessages = messages.slice(offset, offset + perPage);
|
|
15567
|
-
const list = new
|
|
15567
|
+
const list = new chunk6NZQ52RZ_cjs.MessageList().add(
|
|
15568
15568
|
paginatedMessages.map((m) => this.parseStoredMessage(m)),
|
|
15569
15569
|
"memory"
|
|
15570
15570
|
);
|
|
@@ -15598,7 +15598,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
15598
15598
|
async listMessagesById({ messageIds }) {
|
|
15599
15599
|
this.logger.debug(`InMemoryMemory: listMessagesById called`);
|
|
15600
15600
|
const rawMessages = messageIds.map((id) => this.db.messages.get(id)).filter((message) => !!message);
|
|
15601
|
-
const list = new
|
|
15601
|
+
const list = new chunk6NZQ52RZ_cjs.MessageList().add(
|
|
15602
15602
|
rawMessages.map((m) => this.parseStoredMessage(m)),
|
|
15603
15603
|
"memory"
|
|
15604
15604
|
);
|
|
@@ -15630,7 +15630,7 @@ var InMemoryMemory = class extends MemoryStorage {
|
|
|
15630
15630
|
};
|
|
15631
15631
|
this.db.messages.set(key, storageMessage);
|
|
15632
15632
|
}
|
|
15633
|
-
const list = new
|
|
15633
|
+
const list = new chunk6NZQ52RZ_cjs.MessageList().add(messages, "memory");
|
|
15634
15634
|
return { messages: list.get.all.db() };
|
|
15635
15635
|
}
|
|
15636
15636
|
async updateMessages(args) {
|
|
@@ -16502,7 +16502,7 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
16502
16502
|
};
|
|
16503
16503
|
}
|
|
16504
16504
|
async listTraces(args) {
|
|
16505
|
-
const parsed =
|
|
16505
|
+
const parsed = chunkFN6ZOGJ7_cjs.listTracesArgsSchema.parse(args);
|
|
16506
16506
|
const filters = parsed.filters;
|
|
16507
16507
|
const pagination = parsed.pagination ?? { page: 0, perPage: 10 };
|
|
16508
16508
|
const orderBy = parsed.orderBy ?? { field: "startedAt", direction: "DESC" };
|
|
@@ -16534,7 +16534,7 @@ var ObservabilityInMemory = class extends ObservabilityStorage {
|
|
|
16534
16534
|
const end = start + perPage;
|
|
16535
16535
|
const paged = matchingRootSpans.slice(start, end);
|
|
16536
16536
|
return {
|
|
16537
|
-
spans:
|
|
16537
|
+
spans: chunkFN6ZOGJ7_cjs.toTraceSpans(paged),
|
|
16538
16538
|
pagination: { total, page, perPage, hasMore: end < total }
|
|
16539
16539
|
};
|
|
16540
16540
|
}
|
|
@@ -19954,7 +19954,7 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
19954
19954
|
async insert({ tableName, record }) {
|
|
19955
19955
|
const table = this.data[tableName];
|
|
19956
19956
|
let key = record.id;
|
|
19957
|
-
if ([
|
|
19957
|
+
if ([chunkFN6ZOGJ7_cjs.TABLE_WORKFLOW_SNAPSHOT].includes(tableName) && !record.id && record.run_id) {
|
|
19958
19958
|
key = record.workflow_name ? `${record.workflow_name}-${record.run_id}` : record.run_id;
|
|
19959
19959
|
record.id = key;
|
|
19960
19960
|
} else if (!record.id) {
|
|
@@ -19967,7 +19967,7 @@ var StoreOperationsInMemory = class extends StoreOperations {
|
|
|
19967
19967
|
const table = this.data[tableName];
|
|
19968
19968
|
for (const record of records) {
|
|
19969
19969
|
let key = record.id;
|
|
19970
|
-
if ([
|
|
19970
|
+
if ([chunkFN6ZOGJ7_cjs.TABLE_WORKFLOW_SNAPSHOT].includes(tableName) && !record.id && record.run_id) {
|
|
19971
19971
|
key = record.run_id;
|
|
19972
19972
|
record.id = key;
|
|
19973
19973
|
} else if (!record.id) {
|
|
@@ -20100,7 +20100,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
20100
20100
|
return {};
|
|
20101
20101
|
}
|
|
20102
20102
|
return {
|
|
20103
|
-
updateWorkingMemory:
|
|
20103
|
+
updateWorkingMemory: chunkE7PW4ZAB_cjs.createTool({
|
|
20104
20104
|
id: "update-working-memory",
|
|
20105
20105
|
description: `Update the working memory with new information. Any data not included will be overwritten.`,
|
|
20106
20106
|
inputSchema: z37__namespace.default.object({ memory: z37__namespace.default.string() }),
|
|
@@ -20717,7 +20717,7 @@ var SemanticRecall = class {
|
|
|
20717
20717
|
*/
|
|
20718
20718
|
formatCrossThreadMessages(messages, currentThreadId) {
|
|
20719
20719
|
let result = ``;
|
|
20720
|
-
const v1Messages = new
|
|
20720
|
+
const v1Messages = new chunk6NZQ52RZ_cjs.MessageList().add(messages, "memory").get.all.v1();
|
|
20721
20721
|
let lastYmd = null;
|
|
20722
20722
|
for (const msg of v1Messages) {
|
|
20723
20723
|
const date = msg.createdAt;
|
|
@@ -21450,13 +21450,13 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
21450
21450
|
state: processorState.customState,
|
|
21451
21451
|
result: result ?? defaultResult,
|
|
21452
21452
|
abort,
|
|
21453
|
-
...
|
|
21453
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
21454
21454
|
requestContext,
|
|
21455
21455
|
retryCount,
|
|
21456
21456
|
writer
|
|
21457
21457
|
});
|
|
21458
21458
|
const mutations = messageList.stopRecording();
|
|
21459
|
-
if (processResult instanceof
|
|
21459
|
+
if (processResult instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
21460
21460
|
if (processResult !== messageList) {
|
|
21461
21461
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
21462
21462
|
category: "USER",
|
|
@@ -21564,7 +21564,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
21564
21564
|
abort: (reason, options) => {
|
|
21565
21565
|
throw new TripWire(reason || `Stream part blocked by ${processor.id}`, options, processor.id);
|
|
21566
21566
|
},
|
|
21567
|
-
...
|
|
21567
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: state.span }),
|
|
21568
21568
|
requestContext,
|
|
21569
21569
|
messageList,
|
|
21570
21570
|
retryCount,
|
|
@@ -21715,13 +21715,13 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
21715
21715
|
systemMessages: currentSystemMessages,
|
|
21716
21716
|
state: processorState.customState,
|
|
21717
21717
|
abort,
|
|
21718
|
-
...
|
|
21718
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
21719
21719
|
messageList,
|
|
21720
21720
|
requestContext,
|
|
21721
21721
|
retryCount
|
|
21722
21722
|
});
|
|
21723
21723
|
let mutations;
|
|
21724
|
-
if (result instanceof
|
|
21724
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
21725
21725
|
if (result !== messageList) {
|
|
21726
21726
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
21727
21727
|
category: "USER",
|
|
@@ -21806,7 +21806,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
21806
21806
|
*/
|
|
21807
21807
|
async runProcessInputStep(args) {
|
|
21808
21808
|
const { messageList, stepNumber, steps, requestContext, writer } = args;
|
|
21809
|
-
const observabilityContext =
|
|
21809
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(args);
|
|
21810
21810
|
const stepInput = {
|
|
21811
21811
|
messageId: args.messageId,
|
|
21812
21812
|
tools: args.tools,
|
|
@@ -21907,7 +21907,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
21907
21907
|
return nextMessageId;
|
|
21908
21908
|
}
|
|
21909
21909
|
} : {},
|
|
21910
|
-
...
|
|
21910
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
21911
21911
|
retryCount: args.retryCount ?? 0,
|
|
21912
21912
|
writer,
|
|
21913
21913
|
abortSignal: args.abortSignal
|
|
@@ -21994,7 +21994,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
21994
21994
|
retryCount = 0,
|
|
21995
21995
|
writer
|
|
21996
21996
|
} = args;
|
|
21997
|
-
const observabilityContext =
|
|
21997
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(args);
|
|
21998
21998
|
for (const [index, processorOrWorkflow] of this.outputProcessors.entries()) {
|
|
21999
21999
|
const processableMessages = messageList.get.all.db();
|
|
22000
22000
|
const idsBeforeProcessing = processableMessages.map((m) => m.id);
|
|
@@ -22058,13 +22058,13 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
22058
22058
|
steps,
|
|
22059
22059
|
state: processorState.customState,
|
|
22060
22060
|
abort,
|
|
22061
|
-
...
|
|
22061
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: processorSpan }),
|
|
22062
22062
|
requestContext,
|
|
22063
22063
|
retryCount,
|
|
22064
22064
|
writer
|
|
22065
22065
|
});
|
|
22066
22066
|
const mutations = messageList.stopRecording();
|
|
22067
|
-
if (result instanceof
|
|
22067
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
22068
22068
|
if (result !== messageList) {
|
|
22069
22069
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
22070
22070
|
category: "USER",
|
|
@@ -22134,7 +22134,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
22134
22134
|
processor,
|
|
22135
22135
|
stepNumber
|
|
22136
22136
|
}) {
|
|
22137
|
-
if (result instanceof
|
|
22137
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
22138
22138
|
if (result !== messageList) {
|
|
22139
22139
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
22140
22140
|
category: "USER",
|
|
@@ -22970,7 +22970,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
22970
22970
|
} = await processorRunner.processPart(
|
|
22971
22971
|
chunk,
|
|
22972
22972
|
processorStates,
|
|
22973
|
-
|
|
22973
|
+
chunkYTND5227_cjs.resolveObservabilityContext(options),
|
|
22974
22974
|
options.requestContext,
|
|
22975
22975
|
self.messageList,
|
|
22976
22976
|
0,
|
|
@@ -23362,7 +23362,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
23362
23362
|
};
|
|
23363
23363
|
self.messageList = await self.processorRunner.runOutputProcessors(
|
|
23364
23364
|
self.messageList,
|
|
23365
|
-
|
|
23365
|
+
chunkYTND5227_cjs.resolveObservabilityContext(options),
|
|
23366
23366
|
self.#options.requestContext,
|
|
23367
23367
|
0,
|
|
23368
23368
|
outputResultWriter,
|
|
@@ -23370,7 +23370,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
23370
23370
|
);
|
|
23371
23371
|
const responseMessages = self.messageList.get.response.aiV4.core();
|
|
23372
23372
|
const lastResponseMessage = responseMessages[responseMessages.length - 1];
|
|
23373
|
-
const outputText = lastResponseMessage ?
|
|
23373
|
+
const outputText = lastResponseMessage ? chunk6NZQ52RZ_cjs.coreContentToString(lastResponseMessage.content) : "";
|
|
23374
23374
|
if (lastStep && outputText && outputText !== originalText) {
|
|
23375
23375
|
lastStep.text = outputText;
|
|
23376
23376
|
}
|
|
@@ -24740,7 +24740,7 @@ function convertMastraChunkToAISDKv5({
|
|
|
24740
24740
|
if (mode === "generate") {
|
|
24741
24741
|
return {
|
|
24742
24742
|
type: "file",
|
|
24743
|
-
file: new
|
|
24743
|
+
file: new chunk6NZQ52RZ_cjs.DefaultGeneratedFile({
|
|
24744
24744
|
data: chunk.payload.data,
|
|
24745
24745
|
mediaType: chunk.payload.mimeType
|
|
24746
24746
|
})
|
|
@@ -24748,7 +24748,7 @@ function convertMastraChunkToAISDKv5({
|
|
|
24748
24748
|
}
|
|
24749
24749
|
return {
|
|
24750
24750
|
type: "file",
|
|
24751
|
-
file: new
|
|
24751
|
+
file: new chunk6NZQ52RZ_cjs.DefaultGeneratedFileWithType({
|
|
24752
24752
|
data: chunk.payload.data,
|
|
24753
24753
|
mediaType: chunk.payload.mimeType
|
|
24754
24754
|
})
|
|
@@ -24935,7 +24935,7 @@ var getModelOutputForTripwire = async ({
|
|
|
24935
24935
|
messageList,
|
|
24936
24936
|
...rest
|
|
24937
24937
|
}) => {
|
|
24938
|
-
const observabilityContext =
|
|
24938
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
24939
24939
|
const tripwireStream = new web.ReadableStream({
|
|
24940
24940
|
start(controller) {
|
|
24941
24941
|
controller.enqueue({
|
|
@@ -25455,7 +25455,7 @@ async function executeParallel(engine, params) {
|
|
|
25455
25455
|
perStep,
|
|
25456
25456
|
...rest
|
|
25457
25457
|
} = params;
|
|
25458
|
-
const observabilityContext =
|
|
25458
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
25459
25459
|
const parallelSpan = await engine.createChildSpan({
|
|
25460
25460
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
25461
25461
|
operationId: `workflow.${workflowId}.run.${runId}.parallel.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -25533,7 +25533,7 @@ async function executeParallel(engine, params) {
|
|
|
25533
25533
|
state: executionContext.state,
|
|
25534
25534
|
tracingIds: executionContext.tracingIds
|
|
25535
25535
|
},
|
|
25536
|
-
...
|
|
25536
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: parallelSpan }),
|
|
25537
25537
|
pubsub,
|
|
25538
25538
|
abortController,
|
|
25539
25539
|
requestContext,
|
|
@@ -25609,7 +25609,7 @@ async function executeConditional(engine, params) {
|
|
|
25609
25609
|
perStep,
|
|
25610
25610
|
...rest
|
|
25611
25611
|
} = params;
|
|
25612
|
-
const observabilityContext =
|
|
25612
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
25613
25613
|
const conditionalSpan = await engine.createChildSpan({
|
|
25614
25614
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
25615
25615
|
operationId: `workflow.${workflowId}.run.${runId}.conditional.${executionContext.executionPath.join("-")}.span.start`,
|
|
@@ -25651,7 +25651,7 @@ async function executeConditional(engine, params) {
|
|
|
25651
25651
|
inputData: prevOutput,
|
|
25652
25652
|
state: executionContext.state,
|
|
25653
25653
|
retryCount: -1,
|
|
25654
|
-
...
|
|
25654
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
25655
25655
|
getInitData: () => stepResults?.input,
|
|
25656
25656
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
25657
25657
|
bail: (() => {
|
|
@@ -25772,7 +25772,7 @@ async function executeConditional(engine, params) {
|
|
|
25772
25772
|
state: executionContext.state,
|
|
25773
25773
|
tracingIds: executionContext.tracingIds
|
|
25774
25774
|
},
|
|
25775
|
-
...
|
|
25775
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: conditionalSpan }),
|
|
25776
25776
|
pubsub,
|
|
25777
25777
|
abortController,
|
|
25778
25778
|
requestContext,
|
|
@@ -25849,7 +25849,7 @@ async function executeLoop(engine, params) {
|
|
|
25849
25849
|
perStep,
|
|
25850
25850
|
...rest
|
|
25851
25851
|
} = params;
|
|
25852
|
-
const observabilityContext =
|
|
25852
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
25853
25853
|
const { step, condition } = entry;
|
|
25854
25854
|
const loopSpan = await engine.createChildSpan({
|
|
25855
25855
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -25885,7 +25885,7 @@ async function executeLoop(engine, params) {
|
|
|
25885
25885
|
resume: currentResume,
|
|
25886
25886
|
timeTravel: currentTimeTravel,
|
|
25887
25887
|
prevOutput: result.output,
|
|
25888
|
-
...
|
|
25888
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
25889
25889
|
pubsub,
|
|
25890
25890
|
abortController,
|
|
25891
25891
|
requestContext,
|
|
@@ -25939,7 +25939,7 @@ async function executeLoop(engine, params) {
|
|
|
25939
25939
|
inputData: result.output,
|
|
25940
25940
|
state: executionContext.state,
|
|
25941
25941
|
retryCount: -1,
|
|
25942
|
-
...
|
|
25942
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: evalSpan }),
|
|
25943
25943
|
iterationCount: iteration + 1,
|
|
25944
25944
|
getInitData: () => stepResults?.input,
|
|
25945
25945
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
@@ -26011,7 +26011,7 @@ async function executeForeach(engine, params) {
|
|
|
26011
26011
|
perStep,
|
|
26012
26012
|
...rest
|
|
26013
26013
|
} = params;
|
|
26014
|
-
const observabilityContext =
|
|
26014
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
26015
26015
|
const { step, opts } = entry;
|
|
26016
26016
|
const results = [];
|
|
26017
26017
|
const concurrency = opts.concurrency;
|
|
@@ -26087,7 +26087,7 @@ async function executeForeach(engine, params) {
|
|
|
26087
26087
|
executionContext: { ...executionContext, foreachIndex: k },
|
|
26088
26088
|
resume: resumeToUse,
|
|
26089
26089
|
prevOutput: item,
|
|
26090
|
-
...
|
|
26090
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: loopSpan }),
|
|
26091
26091
|
pubsub,
|
|
26092
26092
|
abortController,
|
|
26093
26093
|
requestContext,
|
|
@@ -26371,7 +26371,7 @@ async function executeEntry(engine, params) {
|
|
|
26371
26371
|
perStep,
|
|
26372
26372
|
...rest
|
|
26373
26373
|
} = params;
|
|
26374
|
-
const observabilityContext =
|
|
26374
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
26375
26375
|
const prevOutput = engine.getStepOutput(stepResults, prevStep);
|
|
26376
26376
|
let execResults;
|
|
26377
26377
|
let entryRequestContext;
|
|
@@ -26840,7 +26840,7 @@ async function executeSleep(engine, params) {
|
|
|
26840
26840
|
outputWriter,
|
|
26841
26841
|
...rest
|
|
26842
26842
|
} = params;
|
|
26843
|
-
const observabilityContext =
|
|
26843
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
26844
26844
|
let { duration, fn } = entry;
|
|
26845
26845
|
const sleepSpan = await engine.createChildSpan({
|
|
26846
26846
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -26869,7 +26869,7 @@ async function executeSleep(engine, params) {
|
|
|
26869
26869
|
executionContext.state = state;
|
|
26870
26870
|
},
|
|
26871
26871
|
retryCount: -1,
|
|
26872
|
-
...
|
|
26872
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: sleepSpan }),
|
|
26873
26873
|
getInitData: () => stepResults?.input,
|
|
26874
26874
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
26875
26875
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -26930,7 +26930,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
26930
26930
|
outputWriter,
|
|
26931
26931
|
...rest
|
|
26932
26932
|
} = params;
|
|
26933
|
-
const observabilityContext =
|
|
26933
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
26934
26934
|
let { date, fn } = entry;
|
|
26935
26935
|
const sleepUntilSpan = await engine.createChildSpan({
|
|
26936
26936
|
parentSpan: observabilityContext.tracingContext.currentSpan,
|
|
@@ -26960,7 +26960,7 @@ async function executeSleepUntil(engine, params) {
|
|
|
26960
26960
|
executionContext.state = state;
|
|
26961
26961
|
},
|
|
26962
26962
|
retryCount: -1,
|
|
26963
|
-
...
|
|
26963
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: sleepUntilSpan }),
|
|
26964
26964
|
getInitData: () => stepResults?.input,
|
|
26965
26965
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
26966
26966
|
// TODO: this function shouldn't have suspend probably?
|
|
@@ -27039,7 +27039,7 @@ async function executeStep(engine, params) {
|
|
|
27039
27039
|
perStep,
|
|
27040
27040
|
...rest
|
|
27041
27041
|
} = params;
|
|
27042
|
-
const observabilityContext =
|
|
27042
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
27043
27043
|
const stepCallId = crypto2.randomUUID();
|
|
27044
27044
|
const { inputData, validationError: inputValidationError } = await validateStepInput({
|
|
27045
27045
|
prevOutput,
|
|
@@ -27203,7 +27203,7 @@ async function executeStep(engine, params) {
|
|
|
27203
27203
|
requestContextUpdate: null
|
|
27204
27204
|
};
|
|
27205
27205
|
const isNestedWorkflow = step.component === "WORKFLOW";
|
|
27206
|
-
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra :
|
|
27206
|
+
const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra : chunkYTND5227_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0;
|
|
27207
27207
|
const output = await runStep({
|
|
27208
27208
|
runId,
|
|
27209
27209
|
resourceId,
|
|
@@ -27226,7 +27226,7 @@ async function executeStep(engine, params) {
|
|
|
27226
27226
|
retryCount,
|
|
27227
27227
|
resumeData: resumeDataToUse,
|
|
27228
27228
|
suspendData: suspendDataToUse,
|
|
27229
|
-
...
|
|
27229
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: stepSpan }),
|
|
27230
27230
|
getInitData: () => stepResults?.input,
|
|
27231
27231
|
getStepResult: getStepResult.bind(null, stepResults),
|
|
27232
27232
|
suspend: async (suspendPayload, suspendOptions) => {
|
|
@@ -27328,7 +27328,7 @@ async function executeStep(engine, params) {
|
|
|
27328
27328
|
stepId: step.id,
|
|
27329
27329
|
requestContext,
|
|
27330
27330
|
disableScorers,
|
|
27331
|
-
...
|
|
27331
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: stepSpan })
|
|
27332
27332
|
});
|
|
27333
27333
|
}
|
|
27334
27334
|
if (durableResult.suspended) {
|
|
@@ -27384,7 +27384,7 @@ async function executeStep(engine, params) {
|
|
|
27384
27384
|
}
|
|
27385
27385
|
async function runScorersForStep(params) {
|
|
27386
27386
|
const { engine, scorers, runId, input, output, workflowId, stepId, requestContext, disableScorers, ...rest } = params;
|
|
27387
|
-
const observabilityContext =
|
|
27387
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
27388
27388
|
let scorersToUse = scorers;
|
|
27389
27389
|
if (typeof scorersToUse === "function") {
|
|
27390
27390
|
try {
|
|
@@ -27953,7 +27953,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
|
|
|
27953
27953
|
resume,
|
|
27954
27954
|
timeTravel,
|
|
27955
27955
|
restart,
|
|
27956
|
-
...
|
|
27956
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: workflowSpan }),
|
|
27957
27957
|
abortController: params.abortController,
|
|
27958
27958
|
pubsub: params.pubsub,
|
|
27959
27959
|
requestContext: currentRequestContext,
|
|
@@ -28178,10 +28178,10 @@ function isAgent(input) {
|
|
|
28178
28178
|
return input instanceof Agent;
|
|
28179
28179
|
}
|
|
28180
28180
|
function isToolStep(input) {
|
|
28181
|
-
return input instanceof
|
|
28181
|
+
return input instanceof chunkE7PW4ZAB_cjs.Tool;
|
|
28182
28182
|
}
|
|
28183
28183
|
function isStepParams(input) {
|
|
28184
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof
|
|
28184
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof chunkE7PW4ZAB_cjs.Tool);
|
|
28185
28185
|
}
|
|
28186
28186
|
function createStep(params, agentOrToolOptions) {
|
|
28187
28187
|
if (isAgent(params)) {
|
|
@@ -28243,7 +28243,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
|
|
|
28243
28243
|
writer,
|
|
28244
28244
|
...rest
|
|
28245
28245
|
}) => {
|
|
28246
|
-
const observabilityContext =
|
|
28246
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
28247
28247
|
let streamPromise = {};
|
|
28248
28248
|
streamPromise.promise = new Promise((resolve4, reject) => {
|
|
28249
28249
|
streamPromise.resolve = resolve4;
|
|
@@ -28371,7 +28371,7 @@ function createStepFromTool(params, toolOpts) {
|
|
|
28371
28371
|
setState,
|
|
28372
28372
|
...rest
|
|
28373
28373
|
}) => {
|
|
28374
|
-
const observabilityContext =
|
|
28374
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
28375
28375
|
const toolContext = {
|
|
28376
28376
|
mastra,
|
|
28377
28377
|
requestContext,
|
|
@@ -28502,7 +28502,7 @@ function createStepFromProcessor(processor) {
|
|
|
28502
28502
|
processorIndex: processor.processorIndex
|
|
28503
28503
|
}
|
|
28504
28504
|
}) : void 0;
|
|
28505
|
-
const processorObservabilityContext =
|
|
28505
|
+
const processorObservabilityContext = chunkYTND5227_cjs.createObservabilityContext(
|
|
28506
28506
|
processorSpan ? { currentSpan: processorSpan } : tracingContext
|
|
28507
28507
|
);
|
|
28508
28508
|
const processorWriter = outputWriter ? {
|
|
@@ -28536,7 +28536,7 @@ function createStepFromProcessor(processor) {
|
|
|
28536
28536
|
phase,
|
|
28537
28537
|
// Auto-create MessageList from messages if not provided
|
|
28538
28538
|
// This enables running processor workflows from the UI where messageList can't be serialized
|
|
28539
|
-
messageList: messageList ?? (Array.isArray(messages) ? new
|
|
28539
|
+
messageList: messageList ?? (Array.isArray(messages) ? new chunk6NZQ52RZ_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
|
|
28540
28540
|
stepNumber,
|
|
28541
28541
|
systemMessages,
|
|
28542
28542
|
streamParts,
|
|
@@ -28593,7 +28593,7 @@ function createStepFromProcessor(processor) {
|
|
|
28593
28593
|
messageList: checkedMessageList,
|
|
28594
28594
|
systemMessages: systemMessages ?? []
|
|
28595
28595
|
});
|
|
28596
|
-
if (result instanceof
|
|
28596
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
28597
28597
|
if (result !== checkedMessageList) {
|
|
28598
28598
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
28599
28599
|
category: "USER" /* USER */,
|
|
@@ -28721,7 +28721,7 @@ function createStepFromProcessor(processor) {
|
|
|
28721
28721
|
totalChunks: (streamParts ?? []).length
|
|
28722
28722
|
};
|
|
28723
28723
|
}
|
|
28724
|
-
const processorObservabilityContext2 =
|
|
28724
|
+
const processorObservabilityContext2 = chunkYTND5227_cjs.createObservabilityContext(
|
|
28725
28725
|
processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext
|
|
28726
28726
|
);
|
|
28727
28727
|
let result;
|
|
@@ -28776,7 +28776,7 @@ function createStepFromProcessor(processor) {
|
|
|
28776
28776
|
messageList: passThrough.messageList,
|
|
28777
28777
|
result: passThrough.result ?? defaultResult
|
|
28778
28778
|
});
|
|
28779
|
-
if (result instanceof
|
|
28779
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
28780
28780
|
if (result !== passThrough.messageList) {
|
|
28781
28781
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
28782
28782
|
category: "USER" /* USER */,
|
|
@@ -28843,7 +28843,7 @@ function createStepFromProcessor(processor) {
|
|
|
28843
28843
|
systemMessages: systemMessages ?? [],
|
|
28844
28844
|
steps: steps ?? []
|
|
28845
28845
|
});
|
|
28846
|
-
if (result instanceof
|
|
28846
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
28847
28847
|
if (result !== checkedMessageList) {
|
|
28848
28848
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
28849
28849
|
category: "USER" /* USER */,
|
|
@@ -28911,7 +28911,7 @@ function cloneStep(step, opts) {
|
|
|
28911
28911
|
};
|
|
28912
28912
|
}
|
|
28913
28913
|
function isProcessor(obj) {
|
|
28914
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof
|
|
28914
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof chunkE7PW4ZAB_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
28915
28915
|
}
|
|
28916
28916
|
function createWorkflow(params) {
|
|
28917
28917
|
return new Workflow(params);
|
|
@@ -29467,7 +29467,7 @@ var Workflow = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
29467
29467
|
bail: _bail,
|
|
29468
29468
|
...rest
|
|
29469
29469
|
}) {
|
|
29470
|
-
const observabilityContext =
|
|
29470
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
29471
29471
|
this.__registerMastra(mastra);
|
|
29472
29472
|
const effectiveValidateInputs = validateInputs ?? this.#options.validateInputs ?? true;
|
|
29473
29473
|
this.#options = {
|
|
@@ -29965,8 +29965,8 @@ var Run = class {
|
|
|
29965
29965
|
perStep,
|
|
29966
29966
|
...rest
|
|
29967
29967
|
}) {
|
|
29968
|
-
const observabilityContext =
|
|
29969
|
-
const workflowSpan =
|
|
29968
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
29969
|
+
const workflowSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
29970
29970
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
29971
29971
|
name: `workflow run: '${this.workflowId}'`,
|
|
29972
29972
|
entityType: "workflow_run" /* WORKFLOW_RUN */,
|
|
@@ -30044,7 +30044,7 @@ var Run = class {
|
|
|
30044
30044
|
tracingOptions,
|
|
30045
30045
|
...rest
|
|
30046
30046
|
} = {}) {
|
|
30047
|
-
const observabilityContext =
|
|
30047
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
30048
30048
|
if (this.closeStreamAction) {
|
|
30049
30049
|
return {
|
|
30050
30050
|
stream: this.observeStreamLegacy().stream,
|
|
@@ -30169,7 +30169,7 @@ var Run = class {
|
|
|
30169
30169
|
perStep,
|
|
30170
30170
|
...rest
|
|
30171
30171
|
}) {
|
|
30172
|
-
const observabilityContext =
|
|
30172
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
30173
30173
|
if (this.closeStreamAction && this.streamOutput) {
|
|
30174
30174
|
return this.streamOutput;
|
|
30175
30175
|
}
|
|
@@ -30270,7 +30270,7 @@ var Run = class {
|
|
|
30270
30270
|
perStep,
|
|
30271
30271
|
...rest
|
|
30272
30272
|
} = {}) {
|
|
30273
|
-
const observabilityContext =
|
|
30273
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
30274
30274
|
this.closeStreamAction = async () => {
|
|
30275
30275
|
};
|
|
30276
30276
|
const self = this;
|
|
@@ -30399,7 +30399,7 @@ var Run = class {
|
|
|
30399
30399
|
return this._restart(args);
|
|
30400
30400
|
}
|
|
30401
30401
|
async _resume(params) {
|
|
30402
|
-
const observabilityContext =
|
|
30402
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(params);
|
|
30403
30403
|
const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
|
|
30404
30404
|
const snapshot = await workflowsStore?.loadWorkflowSnapshot({
|
|
30405
30405
|
workflowName: this.workflowId,
|
|
@@ -30473,7 +30473,7 @@ var Run = class {
|
|
|
30473
30473
|
requestContextToUse.set(key, value);
|
|
30474
30474
|
}
|
|
30475
30475
|
});
|
|
30476
|
-
const workflowSpan =
|
|
30476
|
+
const workflowSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
30477
30477
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
30478
30478
|
name: `workflow run: '${this.workflowId}'`,
|
|
30479
30479
|
entityType: "workflow_run" /* WORKFLOW_RUN */,
|
|
@@ -30536,7 +30536,7 @@ var Run = class {
|
|
|
30536
30536
|
tracingOptions,
|
|
30537
30537
|
...rest
|
|
30538
30538
|
}) {
|
|
30539
|
-
const observabilityContext =
|
|
30539
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
30540
30540
|
if (this.workflowEngineType !== "default") {
|
|
30541
30541
|
throw new Error(`restart() is not supported on ${this.workflowEngineType} workflows`);
|
|
30542
30542
|
}
|
|
@@ -30588,7 +30588,7 @@ var Run = class {
|
|
|
30588
30588
|
requestContextToUse.set(key, value);
|
|
30589
30589
|
}
|
|
30590
30590
|
}
|
|
30591
|
-
const workflowSpan =
|
|
30591
|
+
const workflowSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
30592
30592
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
30593
30593
|
name: `workflow run: '${this.workflowId}'`,
|
|
30594
30594
|
entityType: "workflow_run" /* WORKFLOW_RUN */,
|
|
@@ -30639,7 +30639,7 @@ var Run = class {
|
|
|
30639
30639
|
perStep,
|
|
30640
30640
|
...rest
|
|
30641
30641
|
}) {
|
|
30642
|
-
const observabilityContext =
|
|
30642
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
30643
30643
|
if (!stepParam || Array.isArray(stepParam) && stepParam.length === 0) {
|
|
30644
30644
|
throw new Error("Step is required and must be a valid step or array of steps");
|
|
30645
30645
|
}
|
|
@@ -30683,7 +30683,7 @@ var Run = class {
|
|
|
30683
30683
|
requestContextToUse.set(key, value);
|
|
30684
30684
|
}
|
|
30685
30685
|
}
|
|
30686
|
-
const workflowSpan =
|
|
30686
|
+
const workflowSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
30687
30687
|
type: "workflow_run" /* WORKFLOW_RUN */,
|
|
30688
30688
|
name: `workflow run: '${this.workflowId}'`,
|
|
30689
30689
|
input: inputData,
|
|
@@ -30739,7 +30739,7 @@ var Run = class {
|
|
|
30739
30739
|
perStep,
|
|
30740
30740
|
...rest
|
|
30741
30741
|
}) {
|
|
30742
|
-
const observabilityContext =
|
|
30742
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
30743
30743
|
this.closeStreamAction = async () => {
|
|
30744
30744
|
};
|
|
30745
30745
|
const self = this;
|
|
@@ -31045,7 +31045,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
31045
31045
|
}
|
|
31046
31046
|
});
|
|
31047
31047
|
}
|
|
31048
|
-
const observabilityContext =
|
|
31048
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(input);
|
|
31049
31049
|
let runId = input.runId;
|
|
31050
31050
|
if (!runId) {
|
|
31051
31051
|
runId = crypto2.randomUUID();
|
|
@@ -31098,7 +31098,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
31098
31098
|
inputSchema: z37.z.any(),
|
|
31099
31099
|
outputSchema: z37.z.any(),
|
|
31100
31100
|
execute: async ({ inputData, getInitData, ...rest }) => {
|
|
31101
|
-
const observabilityContext =
|
|
31101
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
31102
31102
|
const { accumulatedResults = {}, generatedPrompts = {} } = inputData;
|
|
31103
31103
|
const { run } = getInitData();
|
|
31104
31104
|
const context = this.createScorerContext(scorerStep.name, run, accumulatedResults);
|
|
@@ -32553,7 +32553,7 @@ function createLLMExecutionStep({
|
|
|
32553
32553
|
const processInputStepResult = await processorRunner.runProcessInputStep({
|
|
32554
32554
|
messageList,
|
|
32555
32555
|
stepNumber: inputData.output?.steps?.length || 0,
|
|
32556
|
-
...
|
|
32556
|
+
...chunkYTND5227_cjs.createObservabilityContext(stepTracingContext),
|
|
32557
32557
|
requestContext,
|
|
32558
32558
|
model,
|
|
32559
32559
|
steps: inputData.output?.steps || [],
|
|
@@ -32577,7 +32577,7 @@ function createLLMExecutionStep({
|
|
|
32577
32577
|
if (processInputStepResult.tools && currentStep.tools) {
|
|
32578
32578
|
const convertedTools = {};
|
|
32579
32579
|
for (const [name14, tool3] of Object.entries(currentStep.tools)) {
|
|
32580
|
-
if (
|
|
32580
|
+
if (chunkE7PW4ZAB_cjs.isMastraTool(tool3)) {
|
|
32581
32581
|
convertedTools[name14] = makeCoreTool(
|
|
32582
32582
|
tool3,
|
|
32583
32583
|
{
|
|
@@ -32715,7 +32715,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
32715
32715
|
}
|
|
32716
32716
|
}
|
|
32717
32717
|
if (isSupportedLanguageModel(currentStep.model)) {
|
|
32718
|
-
modelResult =
|
|
32718
|
+
modelResult = chunkYTND5227_cjs.executeWithContextSync({
|
|
32719
32719
|
span: modelSpanTracker?.getTracingContext()?.currentSpan,
|
|
32720
32720
|
fn: () => execute({
|
|
32721
32721
|
runId,
|
|
@@ -32975,7 +32975,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
|
|
|
32975
32975
|
finishReason: immediateFinishReason,
|
|
32976
32976
|
toolCalls: toolCallInfos.length > 0 ? toolCallInfos : void 0,
|
|
32977
32977
|
text: immediateText,
|
|
32978
|
-
...
|
|
32978
|
+
...chunkYTND5227_cjs.createObservabilityContext(outputStepTracingContext),
|
|
32979
32979
|
requestContext,
|
|
32980
32980
|
retryCount: currentRetryCount,
|
|
32981
32981
|
writer: processorWriter
|
|
@@ -33090,7 +33090,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
33090
33090
|
agentName: "LLMMappingStep",
|
|
33091
33091
|
processorStates: rest.processorStates
|
|
33092
33092
|
}) : void 0;
|
|
33093
|
-
const observabilityContext =
|
|
33093
|
+
const observabilityContext = chunkYTND5227_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
33094
33094
|
const streamWriter = rest.outputWriter ? { custom: async (data) => rest.outputWriter(data) } : void 0;
|
|
33095
33095
|
async function processAndEnqueueChunk(chunk) {
|
|
33096
33096
|
if (processorRunner && rest.processorStates) {
|
|
@@ -33182,7 +33182,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
33182
33182
|
toolInvocation: {
|
|
33183
33183
|
state: "result",
|
|
33184
33184
|
toolCallId: toolCallErrorResult.toolCallId,
|
|
33185
|
-
toolName:
|
|
33185
|
+
toolName: chunk6NZQ52RZ_cjs.sanitizeToolName(toolCallErrorResult.toolName),
|
|
33186
33186
|
args: toolCallErrorResult.args,
|
|
33187
33187
|
result: toolCallErrorResult.error?.message ?? toolCallErrorResult.error
|
|
33188
33188
|
},
|
|
@@ -33231,7 +33231,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
33231
33231
|
toolInvocation: {
|
|
33232
33232
|
state: "result",
|
|
33233
33233
|
toolCallId: toolCall.toolCallId,
|
|
33234
|
-
toolName:
|
|
33234
|
+
toolName: chunk6NZQ52RZ_cjs.sanitizeToolName(toolCall.toolName),
|
|
33235
33235
|
args: toolCall.args,
|
|
33236
33236
|
result: toolCall.result
|
|
33237
33237
|
},
|
|
@@ -33257,7 +33257,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
33257
33257
|
toolInvocation: {
|
|
33258
33258
|
state: "result",
|
|
33259
33259
|
toolCallId: toolCall.toolCallId,
|
|
33260
|
-
toolName:
|
|
33260
|
+
toolName: chunk6NZQ52RZ_cjs.sanitizeToolName(toolCall.toolName),
|
|
33261
33261
|
args: toolCall.args,
|
|
33262
33262
|
result: toolCall.result
|
|
33263
33263
|
},
|
|
@@ -33327,7 +33327,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
33327
33327
|
toolInvocation: {
|
|
33328
33328
|
state: "result",
|
|
33329
33329
|
toolCallId: toolCall.toolCallId,
|
|
33330
|
-
toolName:
|
|
33330
|
+
toolName: chunk6NZQ52RZ_cjs.sanitizeToolName(toolCall.toolName),
|
|
33331
33331
|
args: toolCall.args,
|
|
33332
33332
|
result: toolCall.result
|
|
33333
33333
|
},
|
|
@@ -33353,7 +33353,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
|
|
|
33353
33353
|
toolInvocation: {
|
|
33354
33354
|
state: "result",
|
|
33355
33355
|
toolCallId: toolCall.toolCallId,
|
|
33356
|
-
toolName:
|
|
33356
|
+
toolName: chunk6NZQ52RZ_cjs.sanitizeToolName(toolCall.toolName),
|
|
33357
33357
|
args: toolCall.args,
|
|
33358
33358
|
result: toolCall.result
|
|
33359
33359
|
},
|
|
@@ -34252,12 +34252,12 @@ function workflowLoopStream({
|
|
|
34252
34252
|
}
|
|
34253
34253
|
const executionResult = resumeContext ? await run.resume({
|
|
34254
34254
|
resumeData: resumeContext.resumeData,
|
|
34255
|
-
...
|
|
34255
|
+
...chunkYTND5227_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
34256
34256
|
requestContext,
|
|
34257
34257
|
label: toolCallId
|
|
34258
34258
|
}) : await run.start({
|
|
34259
34259
|
inputData: initialData,
|
|
34260
|
-
...
|
|
34260
|
+
...chunkYTND5227_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
|
|
34261
34261
|
requestContext
|
|
34262
34262
|
});
|
|
34263
34263
|
if (executionResult.status !== "success") {
|
|
@@ -34401,7 +34401,7 @@ function loop({
|
|
|
34401
34401
|
}
|
|
34402
34402
|
const baseStream = workflowLoopStream(workflowLoopProps);
|
|
34403
34403
|
const stream = rest.modelSpanTracker?.wrapStream(baseStream) ?? baseStream;
|
|
34404
|
-
const observabilityContext =
|
|
34404
|
+
const observabilityContext = chunkYTND5227_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
|
|
34405
34405
|
modelOutput = new MastraModelOutput({
|
|
34406
34406
|
model: {
|
|
34407
34407
|
modelId: firstModel.model.modelId,
|
|
@@ -34534,7 +34534,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
34534
34534
|
workspace,
|
|
34535
34535
|
...rest
|
|
34536
34536
|
}) {
|
|
34537
|
-
const observabilityContext =
|
|
34537
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
34538
34538
|
let stopWhenToUse;
|
|
34539
34539
|
if (maxSteps && typeof maxSteps === "number") {
|
|
34540
34540
|
stopWhenToUse = chunkTYXLVOEC_cjs.stepCountIs(maxSteps);
|
|
@@ -34884,7 +34884,7 @@ async function prepareMemoryStep({
|
|
|
34884
34884
|
memoryConfig,
|
|
34885
34885
|
...rest
|
|
34886
34886
|
}) {
|
|
34887
|
-
const observabilityContext =
|
|
34887
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
34888
34888
|
const memory = await routingAgent.getMemory({ requestContext });
|
|
34889
34889
|
let thread = await memory?.getThreadById({ threadId });
|
|
34890
34890
|
if (!thread) {
|
|
@@ -34922,7 +34922,7 @@ async function prepareMemoryStep({
|
|
|
34922
34922
|
);
|
|
34923
34923
|
}
|
|
34924
34924
|
} else {
|
|
34925
|
-
const messageList = new
|
|
34925
|
+
const messageList = new chunk6NZQ52RZ_cjs.MessageList({
|
|
34926
34926
|
threadId: thread?.id,
|
|
34927
34927
|
resourceId: thread?.resourceId
|
|
34928
34928
|
});
|
|
@@ -34979,14 +34979,14 @@ async function saveMessagesWithProcessors(memory, messages, processorRunner, con
|
|
|
34979
34979
|
await memory.saveMessages({ messages });
|
|
34980
34980
|
return;
|
|
34981
34981
|
}
|
|
34982
|
-
const messageList = new
|
|
34982
|
+
const messageList = new chunk6NZQ52RZ_cjs.MessageList();
|
|
34983
34983
|
for (const msg of messages) {
|
|
34984
34984
|
messageList.add(msg, "response");
|
|
34985
34985
|
}
|
|
34986
34986
|
const { requestContext, ...observabilityContext } = context ?? {};
|
|
34987
34987
|
await processorRunner.runOutputProcessors(
|
|
34988
34988
|
messageList,
|
|
34989
|
-
|
|
34989
|
+
chunkYTND5227_cjs.resolveObservabilityContext(observabilityContext),
|
|
34990
34990
|
requestContext
|
|
34991
34991
|
);
|
|
34992
34992
|
const processedMessages = messageList.get.response.db();
|
|
@@ -36136,7 +36136,7 @@ async function createNetworkLoop({
|
|
|
36136
36136
|
memory,
|
|
36137
36137
|
context: inputDataToUse,
|
|
36138
36138
|
// TODO: Pass proper tracing context when network supports tracing
|
|
36139
|
-
...
|
|
36139
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: void 0 }),
|
|
36140
36140
|
writer
|
|
36141
36141
|
},
|
|
36142
36142
|
{ toolCallId, messages: [] }
|
|
@@ -36416,7 +36416,7 @@ async function networkLoop({
|
|
|
36416
36416
|
"resumeData": "string"
|
|
36417
36417
|
}
|
|
36418
36418
|
`;
|
|
36419
|
-
const messageList = new
|
|
36419
|
+
const messageList = new chunk6NZQ52RZ_cjs.MessageList();
|
|
36420
36420
|
messageList.addSystem(systemInstructions);
|
|
36421
36421
|
messageList.add(task, "user");
|
|
36422
36422
|
const result = llm.stream({
|
|
@@ -36424,7 +36424,7 @@ async function networkLoop({
|
|
|
36424
36424
|
requestContext,
|
|
36425
36425
|
messageList,
|
|
36426
36426
|
agentId: routingAgent.id,
|
|
36427
|
-
...
|
|
36427
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
36428
36428
|
structuredOutput: {
|
|
36429
36429
|
schema: z37__namespace.default.object({
|
|
36430
36430
|
resumeData: z37__namespace.default.string()
|
|
@@ -36802,7 +36802,7 @@ async function networkLoop({
|
|
|
36802
36802
|
messages,
|
|
36803
36803
|
routingAgent,
|
|
36804
36804
|
generateId: generateId3,
|
|
36805
|
-
...
|
|
36805
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
|
|
36806
36806
|
memoryConfig: routingAgentMemoryOptions?.options
|
|
36807
36807
|
});
|
|
36808
36808
|
return new MastraAgentNetworkStream({
|
|
@@ -36859,13 +36859,13 @@ var AgentLegacyHandler = class {
|
|
|
36859
36859
|
tracingOptions,
|
|
36860
36860
|
...rest
|
|
36861
36861
|
}) {
|
|
36862
|
-
const observabilityContext =
|
|
36862
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
36863
36863
|
return {
|
|
36864
36864
|
before: async () => {
|
|
36865
36865
|
if (process.env.NODE_ENV !== "test") {
|
|
36866
36866
|
this.capabilities.logger.debug(`[Agents:${this.capabilities.name}] - Starting generation`, { runId });
|
|
36867
36867
|
}
|
|
36868
|
-
const agentSpan =
|
|
36868
|
+
const agentSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
36869
36869
|
type: "agent_run" /* AGENT_RUN */,
|
|
36870
36870
|
name: `agent run: '${this.capabilities.id}'`,
|
|
36871
36871
|
entityType: "agent" /* AGENT */,
|
|
@@ -36892,7 +36892,7 @@ var AgentLegacyHandler = class {
|
|
|
36892
36892
|
requestContext,
|
|
36893
36893
|
mastra: this.capabilities.mastra
|
|
36894
36894
|
});
|
|
36895
|
-
const innerObservabilityContext =
|
|
36895
|
+
const innerObservabilityContext = chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
36896
36896
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
36897
36897
|
const toolEnhancements = [
|
|
36898
36898
|
// toolsets
|
|
@@ -36920,7 +36920,7 @@ var AgentLegacyHandler = class {
|
|
|
36920
36920
|
methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
|
|
36921
36921
|
memoryConfig
|
|
36922
36922
|
});
|
|
36923
|
-
let messageList = new
|
|
36923
|
+
let messageList = new chunk6NZQ52RZ_cjs.MessageList({
|
|
36924
36924
|
threadId,
|
|
36925
36925
|
resourceId,
|
|
36926
36926
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -37089,7 +37089,7 @@ var AgentLegacyHandler = class {
|
|
|
37089
37089
|
result: resToLog,
|
|
37090
37090
|
threadId
|
|
37091
37091
|
});
|
|
37092
|
-
const messageListResponses = new
|
|
37092
|
+
const messageListResponses = new chunk6NZQ52RZ_cjs.MessageList({
|
|
37093
37093
|
threadId,
|
|
37094
37094
|
resourceId,
|
|
37095
37095
|
generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
|
|
@@ -37139,7 +37139,7 @@ var AgentLegacyHandler = class {
|
|
|
37139
37139
|
instructions: titleInstructions
|
|
37140
37140
|
} = this.capabilities.resolveTitleGenerationConfig(config?.generateTitle);
|
|
37141
37141
|
if (shouldGenerate && !thread2.title && userMessage) {
|
|
37142
|
-
const observabilityContext2 =
|
|
37142
|
+
const observabilityContext2 = chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
37143
37143
|
promises.push(
|
|
37144
37144
|
this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
|
|
37145
37145
|
if (title) {
|
|
@@ -37209,7 +37209,7 @@ var AgentLegacyHandler = class {
|
|
|
37209
37209
|
overrideScorers,
|
|
37210
37210
|
threadId,
|
|
37211
37211
|
resourceId,
|
|
37212
|
-
...
|
|
37212
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan })
|
|
37213
37213
|
});
|
|
37214
37214
|
const scoringData = {
|
|
37215
37215
|
input: {
|
|
@@ -37289,7 +37289,7 @@ var AgentLegacyHandler = class {
|
|
|
37289
37289
|
writableStream,
|
|
37290
37290
|
methodType,
|
|
37291
37291
|
tracingOptions,
|
|
37292
|
-
...
|
|
37292
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(args)
|
|
37293
37293
|
});
|
|
37294
37294
|
let messageList;
|
|
37295
37295
|
let thread;
|
|
@@ -37441,7 +37441,7 @@ var AgentLegacyHandler = class {
|
|
|
37441
37441
|
return tripwireResult;
|
|
37442
37442
|
}
|
|
37443
37443
|
const { experimental_output, output, agentSpan, ...llmOptions } = beforeResult;
|
|
37444
|
-
const observabilityContext =
|
|
37444
|
+
const observabilityContext = chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
37445
37445
|
let finalOutputProcessors = mergedGenerateOptions.outputProcessors;
|
|
37446
37446
|
if (!output || experimental_output) {
|
|
37447
37447
|
const result2 = await llmToUse.__text({
|
|
@@ -37690,7 +37690,7 @@ var AgentLegacyHandler = class {
|
|
|
37690
37690
|
}
|
|
37691
37691
|
const { onFinish, runId, output, experimental_output, agentSpan, messageList, requestContext, ...llmOptions } = beforeResult;
|
|
37692
37692
|
const overrideScorers = mergedStreamOptions.scorers;
|
|
37693
|
-
const observabilityContext =
|
|
37693
|
+
const observabilityContext = chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
37694
37694
|
if (!output || experimental_output) {
|
|
37695
37695
|
this.capabilities.logger.debug(`Starting agent ${this.capabilities.name} llm stream call`, {
|
|
37696
37696
|
runId
|
|
@@ -37983,7 +37983,7 @@ function createMapResultsStep({
|
|
|
37983
37983
|
const modelOutput = await getModelOutputForTripwire({
|
|
37984
37984
|
tripwire: memoryData.tripwire,
|
|
37985
37985
|
runId,
|
|
37986
|
-
...
|
|
37986
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(observabilityContext),
|
|
37987
37987
|
options,
|
|
37988
37988
|
model: agentModel,
|
|
37989
37989
|
messageList: memoryData.messageList
|
|
@@ -38011,7 +38011,7 @@ function createMapResultsStep({
|
|
|
38011
38011
|
methodType: modelMethodType,
|
|
38012
38012
|
agentId,
|
|
38013
38013
|
requestContext: result.requestContext,
|
|
38014
|
-
...
|
|
38014
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
38015
38015
|
runId,
|
|
38016
38016
|
toolChoice: result.toolChoice,
|
|
38017
38017
|
tools: result.tools,
|
|
@@ -38124,7 +38124,7 @@ var prepareToolsStepOutputSchema = z37.z.object({
|
|
|
38124
38124
|
var prepareMemoryStepOutputSchema = z37.z.object({
|
|
38125
38125
|
threadExists: z37.z.boolean(),
|
|
38126
38126
|
thread: storageThreadSchema.optional(),
|
|
38127
|
-
messageList: z37.z.instanceof(
|
|
38127
|
+
messageList: z37.z.instanceof(chunk6NZQ52RZ_cjs.MessageList),
|
|
38128
38128
|
/** Shared processor states map that persists across loop iterations for both input and output processors */
|
|
38129
38129
|
processorStates: z37.z.instanceof(Map),
|
|
38130
38130
|
/** Tripwire data when input processor triggered abort */
|
|
@@ -38163,9 +38163,9 @@ function createPrepareMemoryStep({
|
|
|
38163
38163
|
inputSchema: z37.z.object({}),
|
|
38164
38164
|
outputSchema: prepareMemoryStepOutputSchema,
|
|
38165
38165
|
execute: async ({ ...rest }) => {
|
|
38166
|
-
const observabilityContext =
|
|
38166
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
38167
38167
|
const thread = threadFromArgs;
|
|
38168
|
-
const messageList = new
|
|
38168
|
+
const messageList = new chunk6NZQ52RZ_cjs.MessageList({
|
|
38169
38169
|
threadId: thread?.id,
|
|
38170
38170
|
resourceId,
|
|
38171
38171
|
generateMessageId: capabilities.generateMessageId,
|
|
@@ -38299,7 +38299,7 @@ function createPrepareToolsStep({
|
|
|
38299
38299
|
resourceId,
|
|
38300
38300
|
runId,
|
|
38301
38301
|
requestContext,
|
|
38302
|
-
...
|
|
38302
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan }),
|
|
38303
38303
|
outputWriter: options.outputWriter,
|
|
38304
38304
|
methodType,
|
|
38305
38305
|
memoryConfig: options.memory?.options,
|
|
@@ -38348,7 +38348,7 @@ function createStreamStep({
|
|
|
38348
38348
|
...validatedInputData,
|
|
38349
38349
|
outputProcessors: processors,
|
|
38350
38350
|
returnScorerData,
|
|
38351
|
-
...
|
|
38351
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(observabilityContext),
|
|
38352
38352
|
requireToolApproval,
|
|
38353
38353
|
toolCallConcurrency,
|
|
38354
38354
|
resumeContext,
|
|
@@ -39808,9 +39808,9 @@ ${errorMessages}`,
|
|
|
39808
39808
|
instructions,
|
|
39809
39809
|
...rest
|
|
39810
39810
|
}) {
|
|
39811
|
-
const observabilityContext =
|
|
39811
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
39812
39812
|
const llm = await this.getLLM({ requestContext, model });
|
|
39813
|
-
const normMessage = new
|
|
39813
|
+
const normMessage = new chunk6NZQ52RZ_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
|
|
39814
39814
|
if (!normMessage) {
|
|
39815
39815
|
throw new Error(`Could not generate title from input ${JSON.stringify(message)}`);
|
|
39816
39816
|
}
|
|
@@ -39833,7 +39833,7 @@ ${errorMessages}`,
|
|
|
39833
39833
|
const systemInstructions = await this.resolveTitleInstructions(requestContext, instructions);
|
|
39834
39834
|
let text = "";
|
|
39835
39835
|
if (isSupportedLanguageModel(llm.getModel())) {
|
|
39836
|
-
const messageList = new
|
|
39836
|
+
const messageList = new chunk6NZQ52RZ_cjs.MessageList().add(
|
|
39837
39837
|
[
|
|
39838
39838
|
{
|
|
39839
39839
|
role: "system",
|
|
@@ -39886,7 +39886,7 @@ ${errorMessages}`,
|
|
|
39886
39886
|
async genTitle(userMessage, requestContext, observabilityContext, model, instructions) {
|
|
39887
39887
|
try {
|
|
39888
39888
|
if (userMessage) {
|
|
39889
|
-
const normMessage = new
|
|
39889
|
+
const normMessage = new chunk6NZQ52RZ_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
|
|
39890
39890
|
if (normMessage) {
|
|
39891
39891
|
return await this.generateTitleFromUserMessage({
|
|
39892
39892
|
message: normMessage,
|
|
@@ -39931,7 +39931,7 @@ ${errorMessages}`,
|
|
|
39931
39931
|
autoResumeSuspendedTools,
|
|
39932
39932
|
...rest
|
|
39933
39933
|
}) {
|
|
39934
|
-
const observabilityContext =
|
|
39934
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
39935
39935
|
let convertedMemoryTools = {};
|
|
39936
39936
|
if (this._agentNetworkAppend) {
|
|
39937
39937
|
this.logger.debug(`[Agent:${this.name}] - Skipping memory tools (agent network context)`, { runId });
|
|
@@ -39986,7 +39986,7 @@ ${errorMessages}`,
|
|
|
39986
39986
|
autoResumeSuspendedTools,
|
|
39987
39987
|
...rest
|
|
39988
39988
|
}) {
|
|
39989
|
-
const observabilityContext =
|
|
39989
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
39990
39990
|
let convertedWorkspaceTools = {};
|
|
39991
39991
|
if (this._agentNetworkAppend) {
|
|
39992
39992
|
this.logger.debug(`[Agent:${this.name}] - Skipping workspace tools (agent network context)`, { runId });
|
|
@@ -39996,7 +39996,7 @@ ${errorMessages}`,
|
|
|
39996
39996
|
if (!workspace) {
|
|
39997
39997
|
return convertedWorkspaceTools;
|
|
39998
39998
|
}
|
|
39999
|
-
const workspaceTools =
|
|
39999
|
+
const workspaceTools = chunkQGT2HJGX_cjs.createWorkspaceTools(workspace);
|
|
40000
40000
|
if (Object.keys(workspaceTools).length > 0) {
|
|
40001
40001
|
this.logger.debug(`[Agent:${this.name}] - Adding workspace tools: ${Object.keys(workspaceTools).join(", ")}`, {
|
|
40002
40002
|
runId
|
|
@@ -40039,7 +40039,7 @@ ${errorMessages}`,
|
|
|
40039
40039
|
autoResumeSuspendedTools,
|
|
40040
40040
|
...rest
|
|
40041
40041
|
}) {
|
|
40042
|
-
const observabilityContext =
|
|
40042
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
40043
40043
|
let convertedSkillTools = {};
|
|
40044
40044
|
if (this._agentNetworkAppend) {
|
|
40045
40045
|
return convertedSkillTools;
|
|
@@ -40048,7 +40048,7 @@ ${errorMessages}`,
|
|
|
40048
40048
|
if (!workspace?.skills) {
|
|
40049
40049
|
return convertedSkillTools;
|
|
40050
40050
|
}
|
|
40051
|
-
const skillTools =
|
|
40051
|
+
const skillTools = chunkQGT2HJGX_cjs.createSkillTools(workspace.skills);
|
|
40052
40052
|
if (Object.keys(skillTools).length > 0) {
|
|
40053
40053
|
this.logger.debug(`[Agent:${this.name}] - Adding skill tools: ${Object.keys(skillTools).join(", ")}`, {
|
|
40054
40054
|
runId
|
|
@@ -40130,7 +40130,7 @@ ${errorMessages}`,
|
|
|
40130
40130
|
*/
|
|
40131
40131
|
async __runProcessInputStep(args) {
|
|
40132
40132
|
const { requestContext, messageList, stepNumber = 0, processorStates, ...rest } = args;
|
|
40133
|
-
const observabilityContext =
|
|
40133
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
40134
40134
|
let tripwire;
|
|
40135
40135
|
if (this.#inputProcessors || this.#memory) {
|
|
40136
40136
|
const runner = await this.getProcessorRunner({
|
|
@@ -40259,7 +40259,7 @@ ${errorMessages}`,
|
|
|
40259
40259
|
autoResumeSuspendedTools,
|
|
40260
40260
|
...rest
|
|
40261
40261
|
}) {
|
|
40262
|
-
const observabilityContext =
|
|
40262
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
40263
40263
|
let toolsForRequest = {};
|
|
40264
40264
|
this.logger.debug(`[Agents:${this.name}] - Assembling assigned tools`, { runId, threadId, resourceId });
|
|
40265
40265
|
const memory = await this.getMemory({ requestContext });
|
|
@@ -40311,7 +40311,7 @@ ${errorMessages}`,
|
|
|
40311
40311
|
autoResumeSuspendedTools,
|
|
40312
40312
|
...rest
|
|
40313
40313
|
}) {
|
|
40314
|
-
const observabilityContext =
|
|
40314
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
40315
40315
|
let toolsForRequest = {};
|
|
40316
40316
|
const memory = await this.getMemory({ requestContext });
|
|
40317
40317
|
const toolsFromToolsets = Object.values(toolsets || {});
|
|
@@ -40358,7 +40358,7 @@ ${errorMessages}`,
|
|
|
40358
40358
|
autoResumeSuspendedTools,
|
|
40359
40359
|
...rest
|
|
40360
40360
|
}) {
|
|
40361
|
-
const observabilityContext =
|
|
40361
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
40362
40362
|
let toolsForRequest = {};
|
|
40363
40363
|
const memory = await this.getMemory({ requestContext });
|
|
40364
40364
|
const clientToolsForInput = Object.entries(clientTools || {});
|
|
@@ -40435,7 +40435,7 @@ ${errorMessages}`,
|
|
|
40435
40435
|
delegation,
|
|
40436
40436
|
...rest
|
|
40437
40437
|
}) {
|
|
40438
|
-
const observabilityContext =
|
|
40438
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
40439
40439
|
const convertedAgentTools = {};
|
|
40440
40440
|
const agents = await this.listAgents({ requestContext });
|
|
40441
40441
|
if (Object.keys(agents).length > 0) {
|
|
@@ -40467,7 +40467,7 @@ ${errorMessages}`,
|
|
|
40467
40467
|
).describe("The results from the agent's tool calls").optional()
|
|
40468
40468
|
});
|
|
40469
40469
|
const modelVersion = (await agent.getModel({ requestContext })).specificationVersion;
|
|
40470
|
-
const toolObj =
|
|
40470
|
+
const toolObj = chunkE7PW4ZAB_cjs.createTool({
|
|
40471
40471
|
id: `agent-${agentName}`,
|
|
40472
40472
|
description: agent.getDescription() || `Agent: ${agentName}`,
|
|
40473
40473
|
inputSchema: agentInputSchema,
|
|
@@ -40663,7 +40663,7 @@ ${effectiveInstructions}`;
|
|
|
40663
40663
|
const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
|
|
40664
40664
|
runId: suspendedToolRunId,
|
|
40665
40665
|
requestContext,
|
|
40666
|
-
...
|
|
40666
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {}),
|
|
40667
40667
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
40668
40668
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
40669
40669
|
...resourceId && threadId ? {
|
|
@@ -40675,7 +40675,7 @@ ${effectiveInstructions}`;
|
|
|
40675
40675
|
} : {}
|
|
40676
40676
|
}) : await agent.generate(messagesForSubAgent, {
|
|
40677
40677
|
requestContext,
|
|
40678
|
-
...
|
|
40678
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {}),
|
|
40679
40679
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
40680
40680
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
40681
40681
|
...resourceId && threadId ? {
|
|
@@ -40739,14 +40739,14 @@ ${effectiveInstructions}`;
|
|
|
40739
40739
|
} else if (methodType === "generate" && modelVersion === "v1") {
|
|
40740
40740
|
const generateResult = await agent.generateLegacy(messagesForSubAgent, {
|
|
40741
40741
|
requestContext,
|
|
40742
|
-
...
|
|
40742
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {})
|
|
40743
40743
|
});
|
|
40744
40744
|
result = { text: generateResult.text };
|
|
40745
40745
|
} else if ((methodType === "stream" || methodType === "streamLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
|
|
40746
40746
|
const streamResult = resumeData ? await agent.resumeStream(resumeData, {
|
|
40747
40747
|
runId: suspendedToolRunId,
|
|
40748
40748
|
requestContext,
|
|
40749
|
-
...
|
|
40749
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {}),
|
|
40750
40750
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
40751
40751
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
40752
40752
|
...resourceId && threadId ? {
|
|
@@ -40760,7 +40760,7 @@ ${effectiveInstructions}`;
|
|
|
40760
40760
|
} : {}
|
|
40761
40761
|
}) : await agent.stream(messagesForSubAgent, {
|
|
40762
40762
|
requestContext,
|
|
40763
|
-
...
|
|
40763
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {}),
|
|
40764
40764
|
...effectiveInstructions && { instructions: effectiveInstructions },
|
|
40765
40765
|
...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
|
|
40766
40766
|
...resourceId && threadId ? {
|
|
@@ -40859,7 +40859,7 @@ ${effectiveInstructions}`;
|
|
|
40859
40859
|
} else {
|
|
40860
40860
|
const streamResult = await agent.streamLegacy(effectivePrompt, {
|
|
40861
40861
|
requestContext,
|
|
40862
|
-
...
|
|
40862
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {})
|
|
40863
40863
|
});
|
|
40864
40864
|
let fullText = "";
|
|
40865
40865
|
for await (const chunk of streamResult.fullStream) {
|
|
@@ -41064,7 +41064,7 @@ ${effectiveInstructions}`;
|
|
|
41064
41064
|
autoResumeSuspendedTools,
|
|
41065
41065
|
...rest
|
|
41066
41066
|
}) {
|
|
41067
|
-
const observabilityContext =
|
|
41067
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
41068
41068
|
const convertedWorkflowTools = {};
|
|
41069
41069
|
const workflows = await this.listWorkflows({ requestContext });
|
|
41070
41070
|
if (Object.keys(workflows).length > 0) {
|
|
@@ -41106,7 +41106,7 @@ ${effectiveInstructions}`;
|
|
|
41106
41106
|
}
|
|
41107
41107
|
]
|
|
41108
41108
|
};
|
|
41109
|
-
const toolObj =
|
|
41109
|
+
const toolObj = chunkE7PW4ZAB_cjs.createTool({
|
|
41110
41110
|
id: `workflow-${workflowName}`,
|
|
41111
41111
|
description: workflow.description || `Workflow: ${workflowName}`,
|
|
41112
41112
|
inputSchema: extendedInputSchema,
|
|
@@ -41135,13 +41135,13 @@ ${effectiveInstructions}`;
|
|
|
41135
41135
|
result = await run.resume({
|
|
41136
41136
|
resumeData,
|
|
41137
41137
|
requestContext,
|
|
41138
|
-
...
|
|
41138
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {})
|
|
41139
41139
|
});
|
|
41140
41140
|
} else {
|
|
41141
41141
|
result = await run.start({
|
|
41142
41142
|
inputData: workflowInputData,
|
|
41143
41143
|
requestContext,
|
|
41144
|
-
...
|
|
41144
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {}),
|
|
41145
41145
|
...initialState && { initialState }
|
|
41146
41146
|
});
|
|
41147
41147
|
}
|
|
@@ -41149,7 +41149,7 @@ ${effectiveInstructions}`;
|
|
|
41149
41149
|
const streamResult = run.streamLegacy({
|
|
41150
41150
|
inputData: workflowInputData,
|
|
41151
41151
|
requestContext,
|
|
41152
|
-
...
|
|
41152
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {})
|
|
41153
41153
|
});
|
|
41154
41154
|
if (context?.writer) {
|
|
41155
41155
|
await streamResult.stream.pipeTo(context.writer);
|
|
@@ -41162,11 +41162,11 @@ ${effectiveInstructions}`;
|
|
|
41162
41162
|
const streamResult = resumeData ? run.resumeStream({
|
|
41163
41163
|
resumeData,
|
|
41164
41164
|
requestContext,
|
|
41165
|
-
...
|
|
41165
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {})
|
|
41166
41166
|
}) : run.stream({
|
|
41167
41167
|
inputData: workflowInputData,
|
|
41168
41168
|
requestContext,
|
|
41169
|
-
...
|
|
41169
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(context ?? {}),
|
|
41170
41170
|
...initialState && { initialState }
|
|
41171
41171
|
});
|
|
41172
41172
|
if (context?.writer) {
|
|
@@ -41285,7 +41285,7 @@ ${effectiveInstructions}`;
|
|
|
41285
41285
|
delegation,
|
|
41286
41286
|
...rest
|
|
41287
41287
|
}) {
|
|
41288
|
-
const observabilityContext =
|
|
41288
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(rest);
|
|
41289
41289
|
let mastraProxy = void 0;
|
|
41290
41290
|
const logger = this.logger;
|
|
41291
41291
|
if (this.#mastra) {
|
|
@@ -41643,7 +41643,7 @@ ${effectiveInstructions}`;
|
|
|
41643
41643
|
resourceId
|
|
41644
41644
|
}) || crypto2.randomUUID();
|
|
41645
41645
|
const instructions = options.instructions || await this.getInstructions({ requestContext });
|
|
41646
|
-
const agentSpan =
|
|
41646
|
+
const agentSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
41647
41647
|
type: "agent_run" /* AGENT_RUN */,
|
|
41648
41648
|
name: `agent run: '${this.id}'`,
|
|
41649
41649
|
entityType: "agent" /* AGENT */,
|
|
@@ -41719,7 +41719,7 @@ ${effectiveInstructions}`;
|
|
|
41719
41719
|
workspace
|
|
41720
41720
|
});
|
|
41721
41721
|
const run = await executionWorkflow.createRun();
|
|
41722
|
-
const observabilityContext =
|
|
41722
|
+
const observabilityContext = chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
41723
41723
|
const result = await run.start({ ...observabilityContext });
|
|
41724
41724
|
return result;
|
|
41725
41725
|
}
|
|
@@ -41743,7 +41743,7 @@ ${effectiveInstructions}`;
|
|
|
41743
41743
|
structuredOutput = false,
|
|
41744
41744
|
overrideScorers
|
|
41745
41745
|
}) {
|
|
41746
|
-
const observabilityContext =
|
|
41746
|
+
const observabilityContext = chunkYTND5227_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
41747
41747
|
const resToLog = {
|
|
41748
41748
|
text: result.text,
|
|
41749
41749
|
object: result.object,
|
|
@@ -42780,7 +42780,7 @@ async function executeTarget2(target, item, targetOptions) {
|
|
|
42780
42780
|
}
|
|
42781
42781
|
}
|
|
42782
42782
|
async function executeWorkflow2(target, item, targetOptions) {
|
|
42783
|
-
const observabilityContext =
|
|
42783
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(item);
|
|
42784
42784
|
const run = await target.createRun({ disableScorers: true });
|
|
42785
42785
|
const workflowResult = await run.start({
|
|
42786
42786
|
...targetOptions,
|
|
@@ -42798,7 +42798,7 @@ async function executeWorkflow2(target, item, targetOptions) {
|
|
|
42798
42798
|
};
|
|
42799
42799
|
}
|
|
42800
42800
|
async function executeAgent2(agent, item, targetOptions) {
|
|
42801
|
-
const observabilityContext =
|
|
42801
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(item);
|
|
42802
42802
|
const model = await agent.getModel();
|
|
42803
42803
|
if (isSupportedLanguageModel(model)) {
|
|
42804
42804
|
const { structuredOutput, ...restOptions } = targetOptions ?? {};
|
|
@@ -42829,7 +42829,7 @@ async function runScorers(scorers, targetResult, item) {
|
|
|
42829
42829
|
output: targetResult.scoringData?.output,
|
|
42830
42830
|
groundTruth: item.groundTruth,
|
|
42831
42831
|
requestContext: item.requestContext,
|
|
42832
|
-
...
|
|
42832
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(item)
|
|
42833
42833
|
});
|
|
42834
42834
|
scorerResults[scorer.id] = score;
|
|
42835
42835
|
} catch (error) {
|
|
@@ -42857,7 +42857,7 @@ async function runScorers(scorers, targetResult, item) {
|
|
|
42857
42857
|
output: targetResult.scoringData.output,
|
|
42858
42858
|
groundTruth: item.groundTruth,
|
|
42859
42859
|
requestContext: item.requestContext,
|
|
42860
|
-
...
|
|
42860
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(item)
|
|
42861
42861
|
});
|
|
42862
42862
|
workflowScorerResults[scorer.id] = score;
|
|
42863
42863
|
}
|
|
@@ -42878,7 +42878,7 @@ async function runScorers(scorers, targetResult, item) {
|
|
|
42878
42878
|
output: stepResult.output,
|
|
42879
42879
|
groundTruth: item.groundTruth,
|
|
42880
42880
|
requestContext: item.requestContext,
|
|
42881
|
-
...
|
|
42881
|
+
...chunkYTND5227_cjs.resolveObservabilityContext(item)
|
|
42882
42882
|
});
|
|
42883
42883
|
stepResults[scorer.id] = score;
|
|
42884
42884
|
} catch (error) {
|
|
@@ -43144,7 +43144,7 @@ async function validateAndSaveScore(storage, payload) {
|
|
|
43144
43144
|
text: "Scores storage domain is not available"
|
|
43145
43145
|
});
|
|
43146
43146
|
}
|
|
43147
|
-
const payloadToSave =
|
|
43147
|
+
const payloadToSave = chunkFN6ZOGJ7_cjs.saveScorePayloadSchema.parse(payload);
|
|
43148
43148
|
await scoresStore.saveScore(payloadToSave);
|
|
43149
43149
|
}
|
|
43150
43150
|
async function findScorer(mastra, entityId, entityType, scorerId) {
|
|
@@ -44752,7 +44752,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
44752
44752
|
engine: {},
|
|
44753
44753
|
abortSignal: abortController?.signal,
|
|
44754
44754
|
// TODO
|
|
44755
|
-
...
|
|
44755
|
+
...chunkYTND5227_cjs.createObservabilityContext()
|
|
44756
44756
|
},
|
|
44757
44757
|
{
|
|
44758
44758
|
paramName: "runCount",
|
|
@@ -44919,7 +44919,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
44919
44919
|
engine: {},
|
|
44920
44920
|
abortSignal: abortController?.signal,
|
|
44921
44921
|
// TODO
|
|
44922
|
-
...
|
|
44922
|
+
...chunkYTND5227_cjs.createObservabilityContext(),
|
|
44923
44923
|
iterationCount
|
|
44924
44924
|
},
|
|
44925
44925
|
{
|
|
@@ -44983,7 +44983,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
44983
44983
|
engine: {},
|
|
44984
44984
|
abortSignal: abortController?.signal,
|
|
44985
44985
|
// TODO
|
|
44986
|
-
...
|
|
44986
|
+
...chunkYTND5227_cjs.createObservabilityContext()
|
|
44987
44987
|
},
|
|
44988
44988
|
{
|
|
44989
44989
|
paramName: "runCount",
|
|
@@ -45050,7 +45050,7 @@ var StepExecutor = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
45050
45050
|
engine: {},
|
|
45051
45051
|
abortSignal: abortController?.signal,
|
|
45052
45052
|
// TODO
|
|
45053
|
-
...
|
|
45053
|
+
...chunkYTND5227_cjs.createObservabilityContext()
|
|
45054
45054
|
},
|
|
45055
45055
|
{
|
|
45056
45056
|
paramName: "runCount",
|
|
@@ -45396,13 +45396,13 @@ function isAgent2(input) {
|
|
|
45396
45396
|
return input instanceof Agent;
|
|
45397
45397
|
}
|
|
45398
45398
|
function isToolStep2(input) {
|
|
45399
|
-
return input instanceof
|
|
45399
|
+
return input instanceof chunkE7PW4ZAB_cjs.Tool;
|
|
45400
45400
|
}
|
|
45401
45401
|
function isStepParams2(input) {
|
|
45402
|
-
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof
|
|
45402
|
+
return input !== null && typeof input === "object" && "id" in input && "execute" in input && !(input instanceof Agent) && !(input instanceof chunkE7PW4ZAB_cjs.Tool);
|
|
45403
45403
|
}
|
|
45404
45404
|
function isProcessor2(obj) {
|
|
45405
|
-
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof
|
|
45405
|
+
return obj !== null && typeof obj === "object" && "id" in obj && typeof obj.id === "string" && !(obj instanceof Agent) && !(obj instanceof chunkE7PW4ZAB_cjs.Tool) && (typeof obj.processInput === "function" || typeof obj.processInputStep === "function" || typeof obj.processOutputStream === "function" || typeof obj.processOutputResult === "function" || typeof obj.processOutputStep === "function");
|
|
45406
45406
|
}
|
|
45407
45407
|
function createStep2(params, agentOrToolOptions) {
|
|
45408
45408
|
if (isAgent2(params)) {
|
|
@@ -45517,7 +45517,7 @@ function createStepFromAgent2(params, agentOrToolOptions) {
|
|
|
45517
45517
|
writer,
|
|
45518
45518
|
...obsFields
|
|
45519
45519
|
}) => {
|
|
45520
|
-
const observabilityContext =
|
|
45520
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(obsFields);
|
|
45521
45521
|
const logger = mastra?.getLogger();
|
|
45522
45522
|
const toolData = {
|
|
45523
45523
|
name: params.name,
|
|
@@ -45619,7 +45619,7 @@ function createStepFromTool2(params, agentOrToolOptions) {
|
|
|
45619
45619
|
setState,
|
|
45620
45620
|
...obsFields
|
|
45621
45621
|
}) => {
|
|
45622
|
-
const observabilityContext =
|
|
45622
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(obsFields);
|
|
45623
45623
|
if (!params.execute) {
|
|
45624
45624
|
throw new Error(`Tool ${params.id} does not have an execute function`);
|
|
45625
45625
|
}
|
|
@@ -45695,7 +45695,7 @@ function createStepFromProcessor2(processor) {
|
|
|
45695
45695
|
inputSchema: chunkVWJ7H3MJ_cjs.toStandardSchema(ProcessorStepSchema),
|
|
45696
45696
|
outputSchema: chunkVWJ7H3MJ_cjs.toStandardSchema(ProcessorStepOutputSchema),
|
|
45697
45697
|
execute: async ({ inputData, requestContext, ...obsFields }) => {
|
|
45698
|
-
const observabilityContext =
|
|
45698
|
+
const observabilityContext = chunkYTND5227_cjs.resolveObservabilityContext(obsFields);
|
|
45699
45699
|
const input = inputData;
|
|
45700
45700
|
const {
|
|
45701
45701
|
phase,
|
|
@@ -45751,7 +45751,7 @@ function createStepFromProcessor2(processor) {
|
|
|
45751
45751
|
processorIndex: processor.processorIndex
|
|
45752
45752
|
}
|
|
45753
45753
|
}) : void 0;
|
|
45754
|
-
const processorObservabilityContext =
|
|
45754
|
+
const processorObservabilityContext = chunkYTND5227_cjs.createObservabilityContext(
|
|
45755
45755
|
processorSpan ? { currentSpan: processorSpan } : observabilityContext.tracingContext
|
|
45756
45756
|
);
|
|
45757
45757
|
const baseContext = {
|
|
@@ -45768,7 +45768,7 @@ function createStepFromProcessor2(processor) {
|
|
|
45768
45768
|
phase,
|
|
45769
45769
|
// Auto-create MessageList from messages if not provided
|
|
45770
45770
|
// This enables running processor workflows from the UI where messageList can't be serialized
|
|
45771
|
-
messageList: messageList ?? (Array.isArray(messages) ? new
|
|
45771
|
+
messageList: messageList ?? (Array.isArray(messages) ? new chunk6NZQ52RZ_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
|
|
45772
45772
|
stepNumber,
|
|
45773
45773
|
systemMessages,
|
|
45774
45774
|
streamParts,
|
|
@@ -45824,7 +45824,7 @@ function createStepFromProcessor2(processor) {
|
|
|
45824
45824
|
messageList: passThrough.messageList,
|
|
45825
45825
|
systemMessages: systemMessages ?? []
|
|
45826
45826
|
});
|
|
45827
|
-
if (result instanceof
|
|
45827
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
45828
45828
|
if (result !== passThrough.messageList) {
|
|
45829
45829
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
45830
45830
|
category: "USER" /* USER */,
|
|
@@ -45949,7 +45949,7 @@ function createStepFromProcessor2(processor) {
|
|
|
45949
45949
|
totalChunks: (streamParts ?? []).length
|
|
45950
45950
|
};
|
|
45951
45951
|
}
|
|
45952
|
-
const processorObservabilityContext2 =
|
|
45952
|
+
const processorObservabilityContext2 = chunkYTND5227_cjs.createObservabilityContext(
|
|
45953
45953
|
processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext
|
|
45954
45954
|
);
|
|
45955
45955
|
let result;
|
|
@@ -46004,7 +46004,7 @@ function createStepFromProcessor2(processor) {
|
|
|
46004
46004
|
messageList: passThrough.messageList,
|
|
46005
46005
|
result: passThrough.result ?? defaultResult
|
|
46006
46006
|
});
|
|
46007
|
-
if (result instanceof
|
|
46007
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
46008
46008
|
if (result !== passThrough.messageList) {
|
|
46009
46009
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
46010
46010
|
category: "USER" /* USER */,
|
|
@@ -46070,7 +46070,7 @@ function createStepFromProcessor2(processor) {
|
|
|
46070
46070
|
systemMessages: systemMessages ?? [],
|
|
46071
46071
|
steps: steps ?? []
|
|
46072
46072
|
});
|
|
46073
|
-
if (result instanceof
|
|
46073
|
+
if (result instanceof chunk6NZQ52RZ_cjs.MessageList) {
|
|
46074
46074
|
if (result !== passThrough.messageList) {
|
|
46075
46075
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
46076
46076
|
category: "USER" /* USER */,
|
|
@@ -49434,10 +49434,10 @@ var Mastra = class {
|
|
|
49434
49434
|
this.#logger?.warn(
|
|
49435
49435
|
'Observability configuration error: Expected an Observability instance, but received a config object. Import and instantiate: import { Observability, DefaultExporter } from "@mastra/observability"; then pass: observability: new Observability({ configs: { default: { serviceName: "mastra", exporters: [new DefaultExporter()] } } }). Observability has been disabled.'
|
|
49436
49436
|
);
|
|
49437
|
-
this.#observability = new
|
|
49437
|
+
this.#observability = new chunkYTND5227_cjs.NoOpObservability();
|
|
49438
49438
|
}
|
|
49439
49439
|
} else {
|
|
49440
|
-
this.#observability = new
|
|
49440
|
+
this.#observability = new chunkYTND5227_cjs.NoOpObservability();
|
|
49441
49441
|
}
|
|
49442
49442
|
this.#storage = storage;
|
|
49443
49443
|
this.#vectors = {};
|
|
@@ -51141,7 +51141,7 @@ var Mastra = class {
|
|
|
51141
51141
|
* Note: For the infrastructure logger (IMastraLogger), use getLogger() instead.
|
|
51142
51142
|
*/
|
|
51143
51143
|
get loggerVNext() {
|
|
51144
|
-
return this.#observability.getDefaultInstance()?.getLoggerContext?.() ??
|
|
51144
|
+
return this.#observability.getDefaultInstance()?.getLoggerContext?.() ?? chunkYTND5227_cjs.noOpLoggerContext;
|
|
51145
51145
|
}
|
|
51146
51146
|
/**
|
|
51147
51147
|
* Direct metrics API for use outside trace context.
|
|
@@ -51149,7 +51149,7 @@ var Mastra = class {
|
|
|
51149
51149
|
* Use for background jobs, startup metrics, or other non-traced scenarios.
|
|
51150
51150
|
*/
|
|
51151
51151
|
get metrics() {
|
|
51152
|
-
return this.#observability.getDefaultInstance()?.getMetricsContext?.() ??
|
|
51152
|
+
return this.#observability.getDefaultInstance()?.getMetricsContext?.() ?? chunkYTND5227_cjs.noOpMetricsContext;
|
|
51153
51153
|
}
|
|
51154
51154
|
getServerMiddleware() {
|
|
51155
51155
|
return this.#serverMiddleware;
|
|
@@ -51709,7 +51709,7 @@ var Mastra = class {
|
|
|
51709
51709
|
if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") {
|
|
51710
51710
|
return;
|
|
51711
51711
|
}
|
|
51712
|
-
import('./provider-registry-
|
|
51712
|
+
import('./provider-registry-IHJW2WNI.cjs').then(async ({ GatewayRegistry: GatewayRegistry2 }) => {
|
|
51713
51713
|
const registry = GatewayRegistry2.getInstance();
|
|
51714
51714
|
const customGateways = Object.values(this.#gateways || {});
|
|
51715
51715
|
registry.registerCustomGateways(customGateways);
|
|
@@ -51772,7 +51772,7 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
51772
51772
|
this.originalTool = input.originalTool;
|
|
51773
51773
|
this.options = input.options;
|
|
51774
51774
|
this.logType = input.logType;
|
|
51775
|
-
if (!
|
|
51775
|
+
if (!chunkE7PW4ZAB_cjs.isVercelTool(this.originalTool) && (input.autoResumeSuspendedTools || this.originalTool.id?.startsWith("agent-") || this.originalTool.id?.startsWith("workflow-"))) {
|
|
51776
51776
|
let schema = this.originalTool.inputSchema;
|
|
51777
51777
|
if (typeof schema === "function") {
|
|
51778
51778
|
schema = schema();
|
|
@@ -51805,7 +51805,7 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
51805
51805
|
}
|
|
51806
51806
|
// Helper to get parameters based on tool type
|
|
51807
51807
|
getParameters = () => {
|
|
51808
|
-
if (
|
|
51808
|
+
if (chunkE7PW4ZAB_cjs.isVercelTool(this.originalTool)) {
|
|
51809
51809
|
let schema2 = this.originalTool.parameters ?? ("inputSchema" in this.originalTool ? this.originalTool.inputSchema : void 0) ?? z37.z.object({});
|
|
51810
51810
|
if (typeof schema2 === "function") {
|
|
51811
51811
|
schema2 = schema2();
|
|
@@ -51951,15 +51951,20 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
51951
51951
|
});
|
|
51952
51952
|
const execFunction = async (args, execOptions) => {
|
|
51953
51953
|
const tracingContext = execOptions.tracingContext || options.tracingContext;
|
|
51954
|
+
const mcpMeta = !chunkE7PW4ZAB_cjs.isVercelTool(tool3) && "mcpMetadata" in tool3 ? tool3.mcpMetadata : void 0;
|
|
51954
51955
|
const toolRequestContext = execOptions.requestContext ?? options.requestContext;
|
|
51955
|
-
const toolSpan =
|
|
51956
|
-
type: "tool_call" /* TOOL_CALL */,
|
|
51957
|
-
name: `tool: '${options.name}'`,
|
|
51956
|
+
const toolSpan = chunkYTND5227_cjs.getOrCreateSpan({
|
|
51957
|
+
type: mcpMeta ? "mcp_tool_call" /* MCP_TOOL_CALL */ : "tool_call" /* TOOL_CALL */,
|
|
51958
|
+
name: mcpMeta ? `mcp_tool: '${options.name}' on '${mcpMeta.serverName}'` : `tool: '${options.name}'`,
|
|
51958
51959
|
input: args,
|
|
51959
51960
|
entityType: "tool" /* TOOL */,
|
|
51960
51961
|
entityId: options.name,
|
|
51961
51962
|
entityName: options.name,
|
|
51962
|
-
attributes: {
|
|
51963
|
+
attributes: mcpMeta ? {
|
|
51964
|
+
mcpServer: mcpMeta.serverName,
|
|
51965
|
+
serverVersion: mcpMeta.serverVersion,
|
|
51966
|
+
toolDescription: options.description
|
|
51967
|
+
} : {
|
|
51963
51968
|
toolDescription: options.description,
|
|
51964
51969
|
toolType: logType || "tool"
|
|
51965
51970
|
},
|
|
@@ -51971,13 +51976,13 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
51971
51976
|
try {
|
|
51972
51977
|
let result;
|
|
51973
51978
|
let suspendData = null;
|
|
51974
|
-
if (
|
|
51975
|
-
result = await
|
|
51979
|
+
if (chunkE7PW4ZAB_cjs.isVercelTool(tool3)) {
|
|
51980
|
+
result = await chunkYTND5227_cjs.executeWithContext({
|
|
51976
51981
|
span: toolSpan,
|
|
51977
51982
|
fn: async () => tool3?.execute?.(args, execOptions)
|
|
51978
51983
|
});
|
|
51979
51984
|
} else {
|
|
51980
|
-
const wrappedMastra = options.mastra ?
|
|
51985
|
+
const wrappedMastra = options.mastra ? chunkYTND5227_cjs.wrapMastra(options.mastra, { currentSpan: toolSpan }) : options.mastra;
|
|
51981
51986
|
const resumeSchema = this.getResumeSchema();
|
|
51982
51987
|
const baseContext = {
|
|
51983
51988
|
threadId: options.threadId,
|
|
@@ -51998,7 +52003,7 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
51998
52003
|
},
|
|
51999
52004
|
options.outputWriter || execOptions.outputWriter
|
|
52000
52005
|
),
|
|
52001
|
-
...
|
|
52006
|
+
...chunkYTND5227_cjs.createObservabilityContext({ currentSpan: toolSpan }),
|
|
52002
52007
|
abortSignal: execOptions.abortSignal,
|
|
52003
52008
|
suspend: (args2, suspendOptions) => {
|
|
52004
52009
|
suspendData = args2;
|
|
@@ -52050,18 +52055,18 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
52050
52055
|
}
|
|
52051
52056
|
const resumeData = execOptions.resumeData;
|
|
52052
52057
|
if (resumeData) {
|
|
52053
|
-
const resumeValidation =
|
|
52058
|
+
const resumeValidation = chunkE7PW4ZAB_cjs.validateToolInput(resumeSchema, resumeData, options.name);
|
|
52054
52059
|
if (resumeValidation.error) {
|
|
52055
52060
|
logger?.warn(resumeValidation.error.message);
|
|
52056
52061
|
toolSpan?.end({ output: resumeValidation.error, attributes: { success: false } });
|
|
52057
52062
|
return resumeValidation.error;
|
|
52058
52063
|
}
|
|
52059
52064
|
}
|
|
52060
|
-
result = await
|
|
52065
|
+
result = await chunkYTND5227_cjs.executeWithContext({ span: toolSpan, fn: async () => tool3?.execute?.(args, toolContext) });
|
|
52061
52066
|
}
|
|
52062
52067
|
if (suspendData) {
|
|
52063
52068
|
const suspendSchema = this.getSuspendSchema();
|
|
52064
|
-
const suspendValidation =
|
|
52069
|
+
const suspendValidation = chunkE7PW4ZAB_cjs.validateToolSuspendData(suspendSchema, suspendData, options.name);
|
|
52065
52070
|
if (suspendValidation.error) {
|
|
52066
52071
|
logger?.warn(suspendValidation.error.message);
|
|
52067
52072
|
toolSpan?.end({ output: suspendValidation.error, attributes: { success: false } });
|
|
@@ -52073,9 +52078,9 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
52073
52078
|
toolSpan?.end({ output: result, attributes: { success: true } });
|
|
52074
52079
|
return result;
|
|
52075
52080
|
}
|
|
52076
|
-
if (
|
|
52081
|
+
if (chunkE7PW4ZAB_cjs.isVercelTool(tool3)) {
|
|
52077
52082
|
const outputSchema = this.getOutputSchema();
|
|
52078
|
-
const outputValidation =
|
|
52083
|
+
const outputValidation = chunkE7PW4ZAB_cjs.validateToolOutput(outputSchema, result, options.name, false);
|
|
52079
52084
|
if (outputValidation.error) {
|
|
52080
52085
|
logger?.warn(outputValidation.error.message);
|
|
52081
52086
|
toolSpan?.end({ output: outputValidation.error, attributes: { success: false } });
|
|
@@ -52095,7 +52100,7 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
52095
52100
|
try {
|
|
52096
52101
|
logger2.debug(start, { ...rest, model: logModelObject, args });
|
|
52097
52102
|
const parameters = this.getParameters();
|
|
52098
|
-
const { data, error: error2 } =
|
|
52103
|
+
const { data, error: error2 } = chunkE7PW4ZAB_cjs.validateToolInput(parameters, args, options.name);
|
|
52099
52104
|
const suspendedToolRunIdErrToIgnore = error2?.message?.includes("suspendedToolRunId: Required") && !args?.resumeData;
|
|
52100
52105
|
if (error2 && !suspendedToolRunIdErrToIgnore) {
|
|
52101
52106
|
logger2.warn(error2.message);
|
|
@@ -52213,7 +52218,7 @@ var CoreToolBuilder = class extends chunkRO47SMI7_cjs.MastraBase {
|
|
|
52213
52218
|
}
|
|
52214
52219
|
let requireApproval = this.options.requireApproval;
|
|
52215
52220
|
let needsApprovalFn;
|
|
52216
|
-
if (
|
|
52221
|
+
if (chunkE7PW4ZAB_cjs.isVercelTool(this.originalTool) && "needsApproval" in this.originalTool) {
|
|
52217
52222
|
const needsApproval = this.originalTool.needsApproval;
|
|
52218
52223
|
if (typeof needsApproval === "boolean") {
|
|
52219
52224
|
requireApproval = needsApproval;
|
|
@@ -52409,7 +52414,7 @@ function ensureToolProperties(tools) {
|
|
|
52409
52414
|
const toolsWithProperties = Object.keys(tools).reduce((acc, key) => {
|
|
52410
52415
|
const tool3 = tools?.[key];
|
|
52411
52416
|
if (tool3) {
|
|
52412
|
-
if (typeof tool3 === "function" && !(tool3 instanceof
|
|
52417
|
+
if (typeof tool3 === "function" && !(tool3 instanceof chunkE7PW4ZAB_cjs.Tool) && !chunkE7PW4ZAB_cjs.isVercelTool(tool3)) {
|
|
52413
52418
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
52414
52419
|
id: "TOOL_INVALID_FORMAT",
|
|
52415
52420
|
domain: "TOOL" /* TOOL */,
|
|
@@ -52417,7 +52422,7 @@ function ensureToolProperties(tools) {
|
|
|
52417
52422
|
text: `Tool "${key}" is not a valid tool format. Tools must be created using createTool() or be a valid Vercel AI SDK tool. Received a function.`
|
|
52418
52423
|
});
|
|
52419
52424
|
}
|
|
52420
|
-
if (
|
|
52425
|
+
if (chunkE7PW4ZAB_cjs.isVercelTool(tool3)) {
|
|
52421
52426
|
acc[key] = setVercelToolProperties(tool3);
|
|
52422
52427
|
} else {
|
|
52423
52428
|
acc[key] = tool3;
|
|
@@ -52834,5 +52839,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
|
|
|
52834
52839
|
exports.validateStepResumeData = validateStepResumeData;
|
|
52835
52840
|
exports.validateStepStateData = validateStepStateData;
|
|
52836
52841
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
52837
|
-
//# sourceMappingURL=chunk-
|
|
52838
|
-
//# sourceMappingURL=chunk-
|
|
52842
|
+
//# sourceMappingURL=chunk-QAIBZ7GH.cjs.map
|
|
52843
|
+
//# sourceMappingURL=chunk-QAIBZ7GH.cjs.map
|