@mastra/core 1.31.0-alpha.0 → 1.31.0-alpha.2
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 +14 -0
- package/dist/agent/agent-legacy.d.ts +11 -0
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/durable/index.cjs +22 -22
- package/dist/agent/durable/index.js +4 -4
- package/dist/agent/index.cjs +9 -9
- package/dist/agent/index.js +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/channels/index.cjs +4 -4
- package/dist/channels/index.js +1 -1
- package/dist/{chunk-T6M7LXNH.js → chunk-2ZK5IF7F.js} +3 -3
- package/dist/{chunk-T6M7LXNH.js.map → chunk-2ZK5IF7F.js.map} +1 -1
- package/dist/{chunk-FNOZT6AO.js → chunk-56YX4QXF.js} +9 -9
- package/dist/{chunk-FNOZT6AO.js.map → chunk-56YX4QXF.js.map} +1 -1
- package/dist/{chunk-JCSNUAZW.js → chunk-7K3DRXR5.js} +3 -3
- package/dist/{chunk-JCSNUAZW.js.map → chunk-7K3DRXR5.js.map} +1 -1
- package/dist/{chunk-JFJ2Z5TP.cjs → chunk-BBGULRCO.cjs} +9 -9
- package/dist/{chunk-JFJ2Z5TP.cjs.map → chunk-BBGULRCO.cjs.map} +1 -1
- package/dist/{chunk-G4LS5NU4.js → chunk-CVPDCNSV.js} +8 -8
- package/dist/{chunk-G4LS5NU4.js.map → chunk-CVPDCNSV.js.map} +1 -1
- package/dist/{chunk-I2GDFWAT.cjs → chunk-DOKVBCA6.cjs} +389 -389
- package/dist/{chunk-I2GDFWAT.cjs.map → chunk-DOKVBCA6.cjs.map} +1 -1
- package/dist/{chunk-2FJAQWKL.cjs → chunk-GM5PX2CG.cjs} +224 -224
- package/dist/{chunk-2FJAQWKL.cjs.map → chunk-GM5PX2CG.cjs.map} +1 -1
- package/dist/{chunk-DQUFXPSD.js → chunk-HQ5T3ORE.js} +6 -6
- package/dist/{chunk-DQUFXPSD.js.map → chunk-HQ5T3ORE.js.map} +1 -1
- package/dist/{chunk-6NWBVKKX.js → chunk-IXX6CCDW.js} +7 -5
- package/dist/chunk-IXX6CCDW.js.map +1 -0
- package/dist/{chunk-ATWCWU4A.cjs → chunk-JGRV2X4U.cjs} +3 -3
- package/dist/{chunk-ATWCWU4A.cjs.map → chunk-JGRV2X4U.cjs.map} +1 -1
- package/dist/{chunk-BJYOYIKM.cjs → chunk-JHS4KPNK.cjs} +5 -5
- package/dist/{chunk-BJYOYIKM.cjs.map → chunk-JHS4KPNK.cjs.map} +1 -1
- package/dist/{chunk-YOSCM4RG.cjs → chunk-N6L3UFHQ.cjs} +3 -3
- package/dist/{chunk-YOSCM4RG.cjs.map → chunk-N6L3UFHQ.cjs.map} +1 -1
- package/dist/{chunk-PXLF2RXT.cjs → chunk-NJPEAYX3.cjs} +20 -20
- package/dist/{chunk-PXLF2RXT.cjs.map → chunk-NJPEAYX3.cjs.map} +1 -1
- package/dist/{chunk-D76ZTSAI.js → chunk-NWMUCSF3.js} +4 -4
- package/dist/{chunk-D76ZTSAI.js.map → chunk-NWMUCSF3.js.map} +1 -1
- package/dist/{chunk-4IXBC75W.cjs → chunk-PMPEPPEM.cjs} +169 -34
- package/dist/chunk-PMPEPPEM.cjs.map +1 -0
- package/dist/{chunk-WKXVKWRG.js → chunk-Q6ZGFUVB.js} +3 -3
- package/dist/{chunk-WKXVKWRG.js.map → chunk-Q6ZGFUVB.js.map} +1 -1
- package/dist/{chunk-4HNDVU6H.cjs → chunk-QIFCHCII.cjs} +18 -18
- package/dist/{chunk-4HNDVU6H.cjs.map → chunk-QIFCHCII.cjs.map} +1 -1
- package/dist/{chunk-5EP5MXPD.cjs → chunk-RB5GPVWV.cjs} +62 -60
- package/dist/chunk-RB5GPVWV.cjs.map +1 -0
- package/dist/{chunk-WE5LBH4J.js → chunk-RPNNSCCV.js} +160 -25
- package/dist/chunk-RPNNSCCV.js.map +1 -0
- package/dist/{chunk-OFOW2B3L.cjs → chunk-RRYFFH4I.cjs} +7 -7
- package/dist/{chunk-OFOW2B3L.cjs.map → chunk-RRYFFH4I.cjs.map} +1 -1
- package/dist/{chunk-AZXBNANX.js → chunk-TBGATHGK.js} +3 -3
- package/dist/{chunk-AZXBNANX.js.map → chunk-TBGATHGK.js.map} +1 -1
- package/dist/{chunk-NXPFGWJP.cjs → chunk-VKILDR4Y.cjs} +6 -6
- package/dist/{chunk-NXPFGWJP.cjs.map → chunk-VKILDR4Y.cjs.map} +1 -1
- package/dist/{chunk-D7YBG3X3.js → chunk-VRSJM3W2.js} +3 -3
- package/dist/{chunk-D7YBG3X3.js.map → chunk-VRSJM3W2.js.map} +1 -1
- package/dist/{chunk-LYX254UT.js → chunk-W6637N6M.js} +4 -4
- package/dist/{chunk-LYX254UT.js.map → chunk-W6637N6M.js.map} +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +242 -242
- package/dist/docs/references/reference-processors-skill-search-processor.md +19 -0
- package/dist/docs/references/reference-tools-perplexity.md +155 -0
- package/dist/docs/references/reference.md +1 -0
- package/dist/evals/index.cjs +6 -6
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +3 -3
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/index.cjs +7 -7
- package/dist/harness/index.js +5 -5
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/llm/index.cjs +20 -20
- package/dist/llm/index.js +5 -5
- package/dist/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/mastra-GU4WOJJ6.js +3 -0
- package/dist/{mastra-M3N2HPTL.js.map → mastra-GU4WOJJ6.js.map} +1 -1
- package/dist/mastra-HZ6MUPHV.cjs +12 -0
- package/dist/{mastra-7KQSO6TX.cjs.map → mastra-HZ6MUPHV.cjs.map} +1 -1
- package/dist/memory/index.cjs +19 -19
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-2U52GDNO.cjs +12 -0
- package/dist/{models-dev-FYM3UMMI.cjs.map → models-dev-2U52GDNO.cjs.map} +1 -1
- package/dist/models-dev-GBYVKYLD.js +3 -0
- package/dist/{models-dev-UUMUDSM2.js.map → models-dev-GBYVKYLD.js.map} +1 -1
- package/dist/netlify-26S2YWQC.js +3 -0
- package/dist/{netlify-5ZBXHVLT.js.map → netlify-26S2YWQC.js.map} +1 -1
- package/dist/netlify-JNHXGWXV.cjs +12 -0
- package/dist/{netlify-CWSVLBIK.cjs.map → netlify-JNHXGWXV.cjs.map} +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +49 -49
- package/dist/processors/index.d.ts +5 -0
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/batch-parts.d.ts.map +1 -1
- package/dist/processors/processors/skill-search.d.ts +1 -0
- package/dist/processors/processors/skill-search.d.ts.map +1 -1
- package/dist/provider-registry-2V4UUBCN.cjs +44 -0
- package/dist/{provider-registry-2ARM242M.cjs.map → provider-registry-2V4UUBCN.cjs.map} +1 -1
- package/dist/provider-registry-ZOKLGIOR.js +3 -0
- package/dist/{provider-registry-P2LJ6OUB.js.map → provider-registry-ZOKLGIOR.js.map} +1 -1
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/runner-DCM7XKBG.cjs +16 -0
- package/dist/{runner-5LZJOXWB.cjs.map → runner-DCM7XKBG.cjs.map} +1 -1
- package/dist/runner-LXMA6PBE.js +3 -0
- package/dist/{runner-FPZRZ3D7.js.map → runner-LXMA6PBE.js.map} +1 -1
- package/dist/storage/index.cjs +59 -59
- package/dist/storage/index.js +2 -2
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/vector/index.cjs +7 -7
- package/dist/vector/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/index.cjs +24 -24
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-4IXBC75W.cjs.map +0 -1
- package/dist/chunk-5EP5MXPD.cjs.map +0 -1
- package/dist/chunk-6NWBVKKX.js.map +0 -1
- package/dist/chunk-WE5LBH4J.js.map +0 -1
- package/dist/mastra-7KQSO6TX.cjs +0 -12
- package/dist/mastra-M3N2HPTL.js +0 -3
- package/dist/models-dev-FYM3UMMI.cjs +0 -12
- package/dist/models-dev-UUMUDSM2.js +0 -3
- package/dist/netlify-5ZBXHVLT.js +0 -3
- package/dist/netlify-CWSVLBIK.cjs +0 -12
- package/dist/provider-registry-2ARM242M.cjs +0 -44
- package/dist/provider-registry-P2LJ6OUB.js +0 -3
- package/dist/runner-5LZJOXWB.cjs +0 -16
- package/dist/runner-FPZRZ3D7.js +0 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunk5C6M2M52_cjs = require('./chunk-5C6M2M52.cjs');
|
|
4
3
|
var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
|
|
5
4
|
var chunkYQR772OH_cjs = require('./chunk-YQR772OH.cjs');
|
|
6
|
-
var
|
|
5
|
+
var chunk5C6M2M52_cjs = require('./chunk-5C6M2M52.cjs');
|
|
6
|
+
var chunkJGRV2X4U_cjs = require('./chunk-JGRV2X4U.cjs');
|
|
7
7
|
var chunk6K4BQ2JS_cjs = require('./chunk-6K4BQ2JS.cjs');
|
|
8
8
|
var chunk7KR4BWEU_cjs = require('./chunk-7KR4BWEU.cjs');
|
|
9
9
|
var chunkQPFIMRQM_cjs = require('./chunk-QPFIMRQM.cjs');
|
|
10
10
|
var chunkRD4AETXE_cjs = require('./chunk-RD4AETXE.cjs');
|
|
11
11
|
var chunkHM6XXOV2_cjs = require('./chunk-HM6XXOV2.cjs');
|
|
12
12
|
var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
|
|
13
|
-
var
|
|
13
|
+
var chunkDOKVBCA6_cjs = require('./chunk-DOKVBCA6.cjs');
|
|
14
14
|
var chunkD6JOUJ6C_cjs = require('./chunk-D6JOUJ6C.cjs');
|
|
15
15
|
var chunkYNE3ZCU5_cjs = require('./chunk-YNE3ZCU5.cjs');
|
|
16
16
|
var chunkIBQB7RSW_cjs = require('./chunk-IBQB7RSW.cjs');
|
|
@@ -2549,7 +2549,7 @@ var ProcessorRunner = class _ProcessorRunner {
|
|
|
2549
2549
|
}
|
|
2550
2550
|
const { model: _model, ...rest } = result;
|
|
2551
2551
|
if (result.model) {
|
|
2552
|
-
const resolvedModel = await
|
|
2552
|
+
const resolvedModel = await chunkDOKVBCA6_cjs.resolveModelConfig(result.model);
|
|
2553
2553
|
const isSupported = isSupportedLanguageModel(resolvedModel);
|
|
2554
2554
|
if (!isSupported) {
|
|
2555
2555
|
throw new chunk4U7ZLI36_cjs.MastraError({
|
|
@@ -10367,7 +10367,9 @@ function createStep(params, agentOrToolOptions) {
|
|
|
10367
10367
|
return createStepFromParams(params);
|
|
10368
10368
|
}
|
|
10369
10369
|
if (isProcessor(params)) {
|
|
10370
|
-
|
|
10370
|
+
const step = createStepFromProcessor(params);
|
|
10371
|
+
step.providesSkillDiscovery = params.providesSkillDiscovery;
|
|
10372
|
+
return step;
|
|
10371
10373
|
}
|
|
10372
10374
|
throw new Error("Invalid input: expected StepParams, Agent, ToolStep, or Processor");
|
|
10373
10375
|
}
|
|
@@ -13740,7 +13742,7 @@ var MastraScorer = class _MastraScorer {
|
|
|
13740
13742
|
}
|
|
13741
13743
|
});
|
|
13742
13744
|
}
|
|
13743
|
-
const resolvedModel = await
|
|
13745
|
+
const resolvedModel = await chunkDOKVBCA6_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
|
|
13744
13746
|
const judgeModel = resolvedModel.modelId;
|
|
13745
13747
|
const judge = new Agent({
|
|
13746
13748
|
id: "judge",
|
|
@@ -15671,7 +15673,7 @@ ${bgPrompt}`;
|
|
|
15671
15673
|
}
|
|
15672
15674
|
});
|
|
15673
15675
|
let transportResolver;
|
|
15674
|
-
if (currentStep.model instanceof
|
|
15676
|
+
if (currentStep.model instanceof chunkDOKVBCA6_cjs.ModelRouterLanguageModel) {
|
|
15675
15677
|
const routerModel = currentStep.model;
|
|
15676
15678
|
transportResolver = () => routerModel._getStreamTransport();
|
|
15677
15679
|
}
|
|
@@ -20219,6 +20221,7 @@ var AgentLegacyHandler = class {
|
|
|
20219
20221
|
writableStream,
|
|
20220
20222
|
methodType,
|
|
20221
20223
|
tracingOptions,
|
|
20224
|
+
inputProcessors,
|
|
20222
20225
|
...rest
|
|
20223
20226
|
}) {
|
|
20224
20227
|
const observabilityContext = chunkIBQB7RSW_cjs.resolveObservabilityContext(rest);
|
|
@@ -20255,7 +20258,7 @@ var AgentLegacyHandler = class {
|
|
|
20255
20258
|
const innerObservabilityContext = chunkIBQB7RSW_cjs.createObservabilityContext({ currentSpan: agentSpan });
|
|
20256
20259
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
20257
20260
|
const threadId = thread?.id;
|
|
20258
|
-
|
|
20261
|
+
let convertedTools = await this.capabilities.convertTools({
|
|
20259
20262
|
toolsets,
|
|
20260
20263
|
clientTools,
|
|
20261
20264
|
threadId,
|
|
@@ -20265,7 +20268,8 @@ var AgentLegacyHandler = class {
|
|
|
20265
20268
|
...innerObservabilityContext,
|
|
20266
20269
|
writableStream,
|
|
20267
20270
|
methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
|
|
20268
|
-
memoryConfig
|
|
20271
|
+
memoryConfig,
|
|
20272
|
+
inputProcessors
|
|
20269
20273
|
});
|
|
20270
20274
|
let messageList = new chunk6K4BQ2JS_cjs.MessageList({
|
|
20271
20275
|
threadId,
|
|
@@ -20279,15 +20283,24 @@ var AgentLegacyHandler = class {
|
|
|
20279
20283
|
const { tripwire: tripwire2 } = await this.capabilities.__runInputProcessors({
|
|
20280
20284
|
requestContext,
|
|
20281
20285
|
...innerObservabilityContext,
|
|
20282
|
-
messageList
|
|
20286
|
+
messageList,
|
|
20287
|
+
inputProcessorOverrides: inputProcessors
|
|
20283
20288
|
});
|
|
20284
20289
|
if (!tripwire2) {
|
|
20285
20290
|
const inputStepResult = await this.capabilities.__runProcessInputStep({
|
|
20286
20291
|
requestContext,
|
|
20287
20292
|
...innerObservabilityContext,
|
|
20288
20293
|
messageList,
|
|
20289
|
-
stepNumber: 0
|
|
20294
|
+
stepNumber: 0,
|
|
20295
|
+
inputProcessorOverrides: inputProcessors,
|
|
20296
|
+
tools: convertedTools,
|
|
20297
|
+
runId,
|
|
20298
|
+
threadId,
|
|
20299
|
+
resourceId
|
|
20290
20300
|
});
|
|
20301
|
+
if (inputStepResult.tools) {
|
|
20302
|
+
convertedTools = inputStepResult.tools;
|
|
20303
|
+
}
|
|
20291
20304
|
if (inputStepResult.tripwire) {
|
|
20292
20305
|
return {
|
|
20293
20306
|
messageObjects: [],
|
|
@@ -20356,7 +20369,8 @@ var AgentLegacyHandler = class {
|
|
|
20356
20369
|
const { messageList: processedMessageList, tripwire } = await this.capabilities.__runInputProcessors({
|
|
20357
20370
|
requestContext,
|
|
20358
20371
|
...innerObservabilityContext,
|
|
20359
|
-
messageList
|
|
20372
|
+
messageList,
|
|
20373
|
+
inputProcessorOverrides: inputProcessors
|
|
20360
20374
|
});
|
|
20361
20375
|
messageList = processedMessageList;
|
|
20362
20376
|
if (!tripwire) {
|
|
@@ -20364,8 +20378,16 @@ var AgentLegacyHandler = class {
|
|
|
20364
20378
|
requestContext,
|
|
20365
20379
|
...innerObservabilityContext,
|
|
20366
20380
|
messageList,
|
|
20367
|
-
stepNumber: 0
|
|
20381
|
+
stepNumber: 0,
|
|
20382
|
+
inputProcessorOverrides: inputProcessors,
|
|
20383
|
+
tools: convertedTools,
|
|
20384
|
+
runId,
|
|
20385
|
+
threadId,
|
|
20386
|
+
resourceId
|
|
20368
20387
|
});
|
|
20388
|
+
if (inputStepResult.tools) {
|
|
20389
|
+
convertedTools = inputStepResult.tools;
|
|
20390
|
+
}
|
|
20369
20391
|
if (inputStepResult.tripwire) {
|
|
20370
20392
|
return {
|
|
20371
20393
|
convertedTools,
|
|
@@ -20595,6 +20617,7 @@ var AgentLegacyHandler = class {
|
|
|
20595
20617
|
tracingOptions,
|
|
20596
20618
|
savePerStep,
|
|
20597
20619
|
writableStream,
|
|
20620
|
+
inputProcessors,
|
|
20598
20621
|
...args
|
|
20599
20622
|
} = options;
|
|
20600
20623
|
const resourceIdFromContext = requestContext.get(chunkKF4FCWWL_cjs.MASTRA_RESOURCE_ID_KEY);
|
|
@@ -20638,6 +20661,7 @@ var AgentLegacyHandler = class {
|
|
|
20638
20661
|
writableStream,
|
|
20639
20662
|
methodType,
|
|
20640
20663
|
tracingOptions,
|
|
20664
|
+
inputProcessors,
|
|
20641
20665
|
...chunkIBQB7RSW_cjs.resolveObservabilityContext(args)
|
|
20642
20666
|
});
|
|
20643
20667
|
let messageList;
|
|
@@ -22027,7 +22051,8 @@ function createPrepareToolsStep({
|
|
|
22027
22051
|
memoryConfig: options.memory?.options,
|
|
22028
22052
|
autoResumeSuspendedTools: options.autoResumeSuspendedTools,
|
|
22029
22053
|
delegation: options.delegation,
|
|
22030
|
-
backgroundTaskEnabled
|
|
22054
|
+
backgroundTaskEnabled,
|
|
22055
|
+
inputProcessors: options.inputProcessors
|
|
22031
22056
|
});
|
|
22032
22057
|
const toolNames = Object.keys(convertedTools);
|
|
22033
22058
|
if (toolNames.length > 0) {
|
|
@@ -22213,6 +22238,50 @@ function resolveMaybePromise(value, cb) {
|
|
|
22213
22238
|
}
|
|
22214
22239
|
return cb(value);
|
|
22215
22240
|
}
|
|
22241
|
+
function hasConfiguredProcessor(processors, predicate) {
|
|
22242
|
+
return processors.some((processor) => {
|
|
22243
|
+
const maybeWorkflow = processor;
|
|
22244
|
+
const isWorkflowLike = isProcessorWorkflow(processor);
|
|
22245
|
+
const workflowSteps = [
|
|
22246
|
+
...Object.values(maybeWorkflow.steps ?? {}),
|
|
22247
|
+
...(maybeWorkflow.stepGraph ?? []).flatMap((entry) => {
|
|
22248
|
+
if (entry.type === "step") {
|
|
22249
|
+
return entry.step ? [entry.step] : [];
|
|
22250
|
+
}
|
|
22251
|
+
return entry.steps?.map((stepEntry) => stepEntry.step).filter(Boolean) ?? [];
|
|
22252
|
+
})
|
|
22253
|
+
];
|
|
22254
|
+
if (!isWorkflowLike || workflowSteps.length === 0) {
|
|
22255
|
+
const processorId = typeof processor.id === "string" && processor.id.startsWith("processor:") ? processor.id.slice("processor:".length) : processor.id;
|
|
22256
|
+
return predicate({
|
|
22257
|
+
...processor,
|
|
22258
|
+
id: processorId,
|
|
22259
|
+
providesSkillDiscovery: processor.providesSkillDiscovery
|
|
22260
|
+
});
|
|
22261
|
+
}
|
|
22262
|
+
return workflowSteps.some((step) => {
|
|
22263
|
+
if (isProcessorWorkflow(step)) {
|
|
22264
|
+
return hasConfiguredProcessor([step], predicate);
|
|
22265
|
+
}
|
|
22266
|
+
const stepId = typeof step.id === "string" ? step.id : void 0;
|
|
22267
|
+
if (!stepId?.startsWith("processor:")) {
|
|
22268
|
+
return false;
|
|
22269
|
+
}
|
|
22270
|
+
const processorId = stepId.slice("processor:".length);
|
|
22271
|
+
const workflowStep = step;
|
|
22272
|
+
return predicate({
|
|
22273
|
+
id: processorId,
|
|
22274
|
+
providesSkillDiscovery: workflowStep.providesSkillDiscovery
|
|
22275
|
+
});
|
|
22276
|
+
});
|
|
22277
|
+
});
|
|
22278
|
+
}
|
|
22279
|
+
function hasEagerSkillsProcessor(processors) {
|
|
22280
|
+
return hasConfiguredProcessor(processors, (processor) => processor.id === "skills-processor");
|
|
22281
|
+
}
|
|
22282
|
+
function hasOnDemandSkillDiscoveryProcessor(processors) {
|
|
22283
|
+
return hasConfiguredProcessor(processors, (processor) => processor.providesSkillDiscovery === "on-demand");
|
|
22284
|
+
}
|
|
22216
22285
|
var Agent = class _Agent extends chunkFCQNDFEW_cjs.MastraBase {
|
|
22217
22286
|
id;
|
|
22218
22287
|
name;
|
|
@@ -22541,10 +22610,9 @@ var Agent = class _Agent extends chunkFCQNDFEW_cjs.MastraBase {
|
|
|
22541
22610
|
if (!workspace?.skills) {
|
|
22542
22611
|
return [];
|
|
22543
22612
|
}
|
|
22544
|
-
const hasSkillsProcessor = configuredProcessors
|
|
22545
|
-
|
|
22546
|
-
)
|
|
22547
|
-
if (hasSkillsProcessor) {
|
|
22613
|
+
const hasSkillsProcessor = hasEagerSkillsProcessor(configuredProcessors);
|
|
22614
|
+
const hasOnDemandProcessor = hasOnDemandSkillDiscoveryProcessor(configuredProcessors);
|
|
22615
|
+
if (hasSkillsProcessor || hasOnDemandProcessor) {
|
|
22548
22616
|
return [];
|
|
22549
22617
|
}
|
|
22550
22618
|
return [new SkillsProcessor({ workspace, format: this.#skillsFormat })];
|
|
@@ -23469,7 +23537,7 @@ ${errorMessages}`,
|
|
|
23469
23537
|
*/
|
|
23470
23538
|
async resolveModelConfig(modelConfig, requestContext) {
|
|
23471
23539
|
try {
|
|
23472
|
-
return await
|
|
23540
|
+
return await chunkDOKVBCA6_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
|
|
23473
23541
|
} catch (error) {
|
|
23474
23542
|
const mastraError = new chunk4U7ZLI36_cjs.MastraError({
|
|
23475
23543
|
id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
|
|
@@ -24110,6 +24178,7 @@ ${errorMessages}`,
|
|
|
24110
24178
|
mastraProxy,
|
|
24111
24179
|
autoResumeSuspendedTools,
|
|
24112
24180
|
backgroundTaskEnabled,
|
|
24181
|
+
suppressEagerSkillTools,
|
|
24113
24182
|
...rest
|
|
24114
24183
|
}) {
|
|
24115
24184
|
const observabilityContext = chunkIBQB7RSW_cjs.resolveObservabilityContext(rest);
|
|
@@ -24125,6 +24194,9 @@ ${errorMessages}`,
|
|
|
24125
24194
|
if (Object.keys(skillTools).length > 0) {
|
|
24126
24195
|
this.logger.debug("Adding skill tools", { agent: this.name, tools: Object.keys(skillTools), runId });
|
|
24127
24196
|
for (const [toolName, tool2] of Object.entries(skillTools)) {
|
|
24197
|
+
if (suppressEagerSkillTools && (toolName === "skill" || toolName === "skill_search")) {
|
|
24198
|
+
continue;
|
|
24199
|
+
}
|
|
24128
24200
|
const toolObj = tool2;
|
|
24129
24201
|
const options = {
|
|
24130
24202
|
name: toolName,
|
|
@@ -24271,18 +24343,34 @@ ${errorMessages}`,
|
|
|
24271
24343
|
* @internal
|
|
24272
24344
|
*/
|
|
24273
24345
|
async __runProcessInputStep(args) {
|
|
24274
|
-
const {
|
|
24346
|
+
const {
|
|
24347
|
+
requestContext,
|
|
24348
|
+
messageList,
|
|
24349
|
+
stepNumber = 0,
|
|
24350
|
+
inputProcessorOverrides,
|
|
24351
|
+
processorStates,
|
|
24352
|
+
tools,
|
|
24353
|
+
runId,
|
|
24354
|
+
threadId,
|
|
24355
|
+
resourceId,
|
|
24356
|
+
outputWriter,
|
|
24357
|
+
autoResumeSuspendedTools,
|
|
24358
|
+
backgroundTaskEnabled,
|
|
24359
|
+
...rest
|
|
24360
|
+
} = args;
|
|
24275
24361
|
const observabilityContext = chunkIBQB7RSW_cjs.resolveObservabilityContext(rest);
|
|
24276
24362
|
let tripwire;
|
|
24277
|
-
|
|
24363
|
+
let nextTools = tools;
|
|
24364
|
+
if (inputProcessorOverrides?.length || this.#inputProcessors || this.#memory) {
|
|
24278
24365
|
const runner = await this.getProcessorRunner({
|
|
24279
24366
|
requestContext,
|
|
24367
|
+
inputProcessorOverrides,
|
|
24280
24368
|
processorStates
|
|
24281
24369
|
});
|
|
24282
24370
|
try {
|
|
24283
24371
|
const llm = await this.getLLM({ requestContext });
|
|
24284
24372
|
const model = llm.getModel();
|
|
24285
|
-
await runner.runProcessInputStep({
|
|
24373
|
+
const result = await runner.runProcessInputStep({
|
|
24286
24374
|
messageList,
|
|
24287
24375
|
stepNumber,
|
|
24288
24376
|
steps: [],
|
|
@@ -24291,8 +24379,47 @@ ${errorMessages}`,
|
|
|
24291
24379
|
// Cast needed: legacy v1 models return LanguageModelV1 which doesn't satisfy MastraLanguageModel.
|
|
24292
24380
|
// OM's processInputStep doesn't use the model parameter, so this is safe.
|
|
24293
24381
|
model,
|
|
24382
|
+
tools,
|
|
24294
24383
|
retryCount: 0
|
|
24295
24384
|
});
|
|
24385
|
+
if (result.tools) {
|
|
24386
|
+
const workspace = await this.getWorkspace({ requestContext });
|
|
24387
|
+
const memory = await this.getMemory({ requestContext });
|
|
24388
|
+
const mastraProxy = this.#mastra ? chunkYNE3ZCU5_cjs.createMastraProxy({ mastra: this.#mastra, logger: this.logger }) : void 0;
|
|
24389
|
+
const convertedTools = {};
|
|
24390
|
+
for (const [name, tool2] of Object.entries(result.tools)) {
|
|
24391
|
+
if (chunkM4KUR53T_cjs.isMastraTool(tool2) || chunkM4KUR53T_cjs.isProviderTool(tool2)) {
|
|
24392
|
+
convertedTools[name] = chunkYNE3ZCU5_cjs.makeCoreTool(
|
|
24393
|
+
tool2,
|
|
24394
|
+
{
|
|
24395
|
+
name,
|
|
24396
|
+
runId,
|
|
24397
|
+
threadId,
|
|
24398
|
+
resourceId,
|
|
24399
|
+
logger: this.logger,
|
|
24400
|
+
mastra: mastraProxy,
|
|
24401
|
+
memory,
|
|
24402
|
+
agentName: this.name,
|
|
24403
|
+
agentId: this.id,
|
|
24404
|
+
requestContext,
|
|
24405
|
+
...observabilityContext,
|
|
24406
|
+
model: await this.getModel({ requestContext }),
|
|
24407
|
+
outputWriter,
|
|
24408
|
+
tracingPolicy: this.#options?.tracingPolicy,
|
|
24409
|
+
requireApproval: tool2.requireApproval,
|
|
24410
|
+
backgroundConfig: tool2.background,
|
|
24411
|
+
workspace
|
|
24412
|
+
},
|
|
24413
|
+
void 0,
|
|
24414
|
+
autoResumeSuspendedTools,
|
|
24415
|
+
backgroundTaskEnabled
|
|
24416
|
+
);
|
|
24417
|
+
} else {
|
|
24418
|
+
convertedTools[name] = tool2;
|
|
24419
|
+
}
|
|
24420
|
+
}
|
|
24421
|
+
nextTools = convertedTools;
|
|
24422
|
+
}
|
|
24296
24423
|
} catch (error) {
|
|
24297
24424
|
if (error instanceof TripWire) {
|
|
24298
24425
|
tripwire = {
|
|
@@ -24322,6 +24449,7 @@ ${errorMessages}`,
|
|
|
24322
24449
|
}
|
|
24323
24450
|
return {
|
|
24324
24451
|
messageList,
|
|
24452
|
+
tools: nextTools,
|
|
24325
24453
|
tripwire
|
|
24326
24454
|
};
|
|
24327
24455
|
}
|
|
@@ -25579,6 +25707,7 @@ ${effectiveInstructions}`;
|
|
|
25579
25707
|
autoResumeSuspendedTools,
|
|
25580
25708
|
delegation,
|
|
25581
25709
|
backgroundTaskEnabled,
|
|
25710
|
+
inputProcessors,
|
|
25582
25711
|
...rest
|
|
25583
25712
|
}) {
|
|
25584
25713
|
const observabilityContext = chunkIBQB7RSW_cjs.resolveObservabilityContext(rest);
|
|
@@ -25660,6 +25789,9 @@ ${effectiveInstructions}`;
|
|
|
25660
25789
|
autoResumeSuspendedTools,
|
|
25661
25790
|
backgroundTaskEnabled
|
|
25662
25791
|
});
|
|
25792
|
+
const configuredInputProcessors = inputProcessors ?? await this.listConfiguredInputProcessors(requestContext);
|
|
25793
|
+
const hasOnDemandProcessor = hasOnDemandSkillDiscoveryProcessor(configuredInputProcessors);
|
|
25794
|
+
const hasSkillsProcessor = hasEagerSkillsProcessor(configuredInputProcessors);
|
|
25663
25795
|
const skillTools = await this.listSkillTools({
|
|
25664
25796
|
runId,
|
|
25665
25797
|
resourceId,
|
|
@@ -25668,7 +25800,8 @@ ${effectiveInstructions}`;
|
|
|
25668
25800
|
...observabilityContext,
|
|
25669
25801
|
mastraProxy,
|
|
25670
25802
|
autoResumeSuspendedTools,
|
|
25671
|
-
backgroundTaskEnabled
|
|
25803
|
+
backgroundTaskEnabled,
|
|
25804
|
+
suppressEagerSkillTools: hasOnDemandProcessor && !hasSkillsProcessor
|
|
25672
25805
|
});
|
|
25673
25806
|
const channelTools = await this.listChannelTools({
|
|
25674
25807
|
runId,
|
|
@@ -25833,7 +25966,7 @@ ${effectiveInstructions}`;
|
|
|
25833
25966
|
const resolvedModel = await this.resolveModelConfig(selection, requestContext);
|
|
25834
25967
|
this.assertSupportsPreparedModels(resolvedModel);
|
|
25835
25968
|
let headers;
|
|
25836
|
-
if (resolvedModel instanceof
|
|
25969
|
+
if (resolvedModel instanceof chunkDOKVBCA6_cjs.ModelRouterLanguageModel) {
|
|
25837
25970
|
headers = resolvedModel.config?.headers;
|
|
25838
25971
|
}
|
|
25839
25972
|
return [
|
|
@@ -25865,7 +25998,7 @@ ${effectiveInstructions}`;
|
|
|
25865
25998
|
throw mastraError;
|
|
25866
25999
|
}
|
|
25867
26000
|
let routerHeaders;
|
|
25868
|
-
if (model instanceof
|
|
26001
|
+
if (model instanceof chunkDOKVBCA6_cjs.ModelRouterLanguageModel) {
|
|
25869
26002
|
routerHeaders = model.config?.headers;
|
|
25870
26003
|
}
|
|
25871
26004
|
const isEnabled = modelConfig.enabled ?? true;
|
|
@@ -28187,10 +28320,11 @@ var BatchPartsProcessor = class {
|
|
|
28187
28320
|
const textChunks = state.batch.filter((part) => part.type === "text-delta");
|
|
28188
28321
|
if (textChunks.length > 0) {
|
|
28189
28322
|
const combinedText = textChunks.map((part) => part.type === "text-delta" ? part.payload.text : "").join("");
|
|
28323
|
+
const firstChunk = textChunks[0];
|
|
28190
28324
|
const combinedChunk = {
|
|
28191
28325
|
type: "text-delta",
|
|
28192
|
-
payload: { text: combinedText, id:
|
|
28193
|
-
runId:
|
|
28326
|
+
payload: { text: combinedText, id: firstChunk.payload.id },
|
|
28327
|
+
runId: firstChunk.runId,
|
|
28194
28328
|
from: "AGENT" /* AGENT */
|
|
28195
28329
|
};
|
|
28196
28330
|
state.batch = [];
|
|
@@ -29544,6 +29678,7 @@ var SkillSearchProcessor = class {
|
|
|
29544
29678
|
id = "skill-search";
|
|
29545
29679
|
name = "Skill Search Processor";
|
|
29546
29680
|
description = "Enables on-demand skill discovery and loading via search";
|
|
29681
|
+
providesSkillDiscovery = "on-demand";
|
|
29547
29682
|
workspace;
|
|
29548
29683
|
searchConfig;
|
|
29549
29684
|
ttl;
|
|
@@ -29685,7 +29820,7 @@ var SkillSearchProcessor = class {
|
|
|
29685
29820
|
id: "search_skills",
|
|
29686
29821
|
description: "Search for available skills by keyword. Returns a list of matching skills with their names and descriptions. After finding a useful skill, use load_skill to load its instructions.",
|
|
29687
29822
|
inputSchema: v4.z.object({
|
|
29688
|
-
query: v4.z.string().describe('Search keywords (e.g., "api design", "testing", "deployment")')
|
|
29823
|
+
query: v4.z.string().trim().min(1, "Query is required").describe('Search keywords (e.g., "api design", "testing", "deployment")')
|
|
29689
29824
|
}),
|
|
29690
29825
|
outputSchema: v4.z.object({
|
|
29691
29826
|
results: v4.z.array(
|
|
@@ -31091,7 +31226,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
31091
31226
|
);
|
|
31092
31227
|
}
|
|
31093
31228
|
if (typeof config.embedder === "string") {
|
|
31094
|
-
this.embedder = new
|
|
31229
|
+
this.embedder = new chunkDOKVBCA6_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
31095
31230
|
} else {
|
|
31096
31231
|
this.embedder = config.embedder;
|
|
31097
31232
|
}
|
|
@@ -31104,7 +31239,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
|
|
|
31104
31239
|
}
|
|
31105
31240
|
if (config.embedder) {
|
|
31106
31241
|
if (typeof config.embedder === "string") {
|
|
31107
|
-
this.embedder = new
|
|
31242
|
+
this.embedder = new chunkDOKVBCA6_cjs.ModelRouterEmbeddingModel(config.embedder);
|
|
31108
31243
|
} else {
|
|
31109
31244
|
this.embedder = config.embedder;
|
|
31110
31245
|
}
|
|
@@ -31144,7 +31279,7 @@ https://mastra.ai/en/docs/memory/overview`
|
|
|
31144
31279
|
}
|
|
31145
31280
|
setEmbedder(embedder, embedderOptions) {
|
|
31146
31281
|
if (typeof embedder === "string") {
|
|
31147
|
-
this.embedder = new
|
|
31282
|
+
this.embedder = new chunkDOKVBCA6_cjs.ModelRouterEmbeddingModel(embedder);
|
|
31148
31283
|
} else {
|
|
31149
31284
|
this.embedder = embedder;
|
|
31150
31285
|
}
|
|
@@ -31596,7 +31731,7 @@ var MockMemory = class extends MastraMemory {
|
|
|
31596
31731
|
} = {}) {
|
|
31597
31732
|
super({
|
|
31598
31733
|
name: "mock",
|
|
31599
|
-
storage: storage || new
|
|
31734
|
+
storage: storage || new chunkJGRV2X4U_cjs.InMemoryStore(),
|
|
31600
31735
|
options: {
|
|
31601
31736
|
...options,
|
|
31602
31737
|
workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : options?.workingMemory,
|
|
@@ -31941,5 +32076,5 @@ exports.validateStepResumeData = validateStepResumeData;
|
|
|
31941
32076
|
exports.validateStepStateData = validateStepStateData;
|
|
31942
32077
|
exports.validateStepSuspendData = validateStepSuspendData;
|
|
31943
32078
|
exports.withStreamCaching = withStreamCaching;
|
|
31944
|
-
//# sourceMappingURL=chunk-
|
|
31945
|
-
//# sourceMappingURL=chunk-
|
|
32079
|
+
//# sourceMappingURL=chunk-PMPEPPEM.cjs.map
|
|
32080
|
+
//# sourceMappingURL=chunk-PMPEPPEM.cjs.map
|