@mastra/core 1.31.0-alpha.0 → 1.31.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -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-D7YBG3X3.js → chunk-3K3ANRQO.js} +3 -3
- package/dist/{chunk-D7YBG3X3.js.map → chunk-3K3ANRQO.js.map} +1 -1
- package/dist/{chunk-D76ZTSAI.js → chunk-4GCGRFND.js} +4 -4
- package/dist/{chunk-D76ZTSAI.js.map → chunk-4GCGRFND.js.map} +1 -1
- package/dist/{chunk-WE5LBH4J.js → chunk-4SXW4BMV.js} +155 -21
- package/dist/chunk-4SXW4BMV.js.map +1 -0
- package/dist/{chunk-DQUFXPSD.js → chunk-5D3IKSJ3.js} +6 -6
- package/dist/{chunk-DQUFXPSD.js.map → chunk-5D3IKSJ3.js.map} +1 -1
- package/dist/{chunk-I2GDFWAT.cjs → chunk-CF4OVR4V.cjs} +389 -389
- package/dist/{chunk-I2GDFWAT.cjs.map → chunk-CF4OVR4V.cjs.map} +1 -1
- package/dist/{chunk-LYX254UT.js → chunk-CTG4B5FM.js} +4 -4
- package/dist/{chunk-LYX254UT.js.map → chunk-CTG4B5FM.js.map} +1 -1
- package/dist/{chunk-JFJ2Z5TP.cjs → chunk-DL4C5DUI.cjs} +9 -9
- package/dist/{chunk-JFJ2Z5TP.cjs.map → chunk-DL4C5DUI.cjs.map} +1 -1
- package/dist/{chunk-OFOW2B3L.cjs → chunk-DY3EL2XK.cjs} +7 -7
- package/dist/{chunk-OFOW2B3L.cjs.map → chunk-DY3EL2XK.cjs.map} +1 -1
- package/dist/{chunk-YOSCM4RG.cjs → chunk-EFCRYCP4.cjs} +3 -3
- package/dist/{chunk-YOSCM4RG.cjs.map → chunk-EFCRYCP4.cjs.map} +1 -1
- package/dist/{chunk-4HNDVU6H.cjs → chunk-FPWDEJ5W.cjs} +18 -18
- package/dist/{chunk-4HNDVU6H.cjs.map → chunk-FPWDEJ5W.cjs.map} +1 -1
- package/dist/{chunk-5EP5MXPD.cjs → chunk-GBQCYCSH.cjs} +60 -58
- package/dist/chunk-GBQCYCSH.cjs.map +1 -0
- package/dist/{chunk-2FJAQWKL.cjs → chunk-GYTX6IH2.cjs} +224 -224
- package/dist/{chunk-2FJAQWKL.cjs.map → chunk-GYTX6IH2.cjs.map} +1 -1
- package/dist/{chunk-T6M7LXNH.js → chunk-K4RFAZEH.js} +3 -3
- package/dist/{chunk-T6M7LXNH.js.map → chunk-K4RFAZEH.js.map} +1 -1
- package/dist/{chunk-PXLF2RXT.cjs → chunk-LAPVI43X.cjs} +20 -20
- package/dist/{chunk-PXLF2RXT.cjs.map → chunk-LAPVI43X.cjs.map} +1 -1
- package/dist/{chunk-AZXBNANX.js → chunk-MVVXAPBL.js} +3 -3
- package/dist/{chunk-AZXBNANX.js.map → chunk-MVVXAPBL.js.map} +1 -1
- package/dist/{chunk-BJYOYIKM.cjs → chunk-OS6YC5Q4.cjs} +5 -5
- package/dist/{chunk-BJYOYIKM.cjs.map → chunk-OS6YC5Q4.cjs.map} +1 -1
- package/dist/{chunk-NXPFGWJP.cjs → chunk-V5E2OIV6.cjs} +6 -6
- package/dist/{chunk-NXPFGWJP.cjs.map → chunk-V5E2OIV6.cjs.map} +1 -1
- package/dist/{chunk-4IXBC75W.cjs → chunk-V5IWNIFA.cjs} +163 -29
- package/dist/chunk-V5IWNIFA.cjs.map +1 -0
- package/dist/{chunk-WKXVKWRG.js → chunk-VL3337EG.js} +3 -3
- package/dist/{chunk-WKXVKWRG.js.map → chunk-VL3337EG.js.map} +1 -1
- package/dist/{chunk-FNOZT6AO.js → chunk-WT2IVQBJ.js} +9 -9
- package/dist/{chunk-FNOZT6AO.js.map → chunk-WT2IVQBJ.js.map} +1 -1
- package/dist/{chunk-G4LS5NU4.js → chunk-YVTA4K6K.js} +8 -8
- package/dist/{chunk-G4LS5NU4.js.map → chunk-YVTA4K6K.js.map} +1 -1
- package/dist/{chunk-6NWBVKKX.js → chunk-ZFAQVP7L.js} +6 -4
- package/dist/chunk-ZFAQVP7L.js.map +1 -0
- package/dist/datasets/index.cjs +11 -11
- package/dist/datasets/index.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +181 -181
- package/dist/docs/references/reference-processors-skill-search-processor.md +19 -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-CGB7BBSZ.cjs +12 -0
- package/dist/{mastra-7KQSO6TX.cjs.map → mastra-CGB7BBSZ.cjs.map} +1 -1
- package/dist/mastra-SGOF2FOS.js +3 -0
- package/dist/{mastra-M3N2HPTL.js.map → mastra-SGOF2FOS.js.map} +1 -1
- package/dist/memory/index.cjs +19 -19
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-IOEEN3JP.cjs +12 -0
- package/dist/{models-dev-FYM3UMMI.cjs.map → models-dev-IOEEN3JP.cjs.map} +1 -1
- package/dist/models-dev-TJARBWXY.js +3 -0
- package/dist/{models-dev-UUMUDSM2.js.map → models-dev-TJARBWXY.js.map} +1 -1
- package/dist/netlify-AQ2SWPGA.cjs +12 -0
- package/dist/{netlify-CWSVLBIK.cjs.map → netlify-AQ2SWPGA.cjs.map} +1 -1
- package/dist/netlify-ZXYH6R7F.js +3 -0
- package/dist/{netlify-5ZBXHVLT.js.map → netlify-ZXYH6R7F.js.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/skill-search.d.ts +1 -0
- package/dist/processors/processors/skill-search.d.ts.map +1 -1
- package/dist/provider-registry-E2XHEEJ2.js +3 -0
- package/dist/{provider-registry-P2LJ6OUB.js.map → provider-registry-E2XHEEJ2.js.map} +1 -1
- package/dist/provider-registry-LFSFCOQ6.cjs +44 -0
- package/dist/{provider-registry-2ARM242M.cjs.map → provider-registry-LFSFCOQ6.cjs.map} +1 -1
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/runner-3WGI2L4I.js +3 -0
- package/dist/{runner-FPZRZ3D7.js.map → runner-3WGI2L4I.js.map} +1 -1
- package/dist/runner-LCX6F5B5.cjs +16 -0
- package/dist/{runner-5LZJOXWB.cjs.map → runner-LCX6F5B5.cjs.map} +1 -1
- 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/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
|
@@ -8,7 +8,7 @@ import { APICallError, generateId, tool, asSchema } from './chunk-32WQTREY.js';
|
|
|
8
8
|
import { noopLogger } from './chunk-XP24DYKA.js';
|
|
9
9
|
import { EventEmitterPubSub } from './chunk-4E5FOY4E.js';
|
|
10
10
|
import { executeHook } from './chunk-L54GIUCB.js';
|
|
11
|
-
import { resolveModelConfig, ModelRouterEmbeddingModel, ModelRouterLanguageModel } from './chunk-
|
|
11
|
+
import { resolveModelConfig, ModelRouterEmbeddingModel, ModelRouterLanguageModel } from './chunk-5D3IKSJ3.js';
|
|
12
12
|
import { MastraLLMV1 } from './chunk-LRE7DKY3.js';
|
|
13
13
|
import { removeUndefinedValues, safeStringify, ensureToolProperties, makeCoreTool, createMastraProxy, deepMerge, generateEmptyFromSchema, selectFields, ensureSerializable, delay } from './chunk-ARNDQ2SQ.js';
|
|
14
14
|
import { resolveObservabilityContext, createObservabilityContext, wrapMastra } from './chunk-SR7NB44E.js';
|
|
@@ -16,7 +16,7 @@ import { getRootExportSpan, getOrCreateSpan, executeWithContext, executeWithCont
|
|
|
16
16
|
import { EntityType } from './chunk-A6UBX7NY.js';
|
|
17
17
|
import { MastraError, getErrorFromUnknown } from './chunk-FJEVLHJT.js';
|
|
18
18
|
import { ToolStream } from './chunk-DD2VNRQM.js';
|
|
19
|
-
import { createTool, Tool, isProviderTool, isProviderDefinedTool,
|
|
19
|
+
import { createTool, Tool, isMastraTool, isProviderTool, isProviderDefinedTool, getProviderToolName } from './chunk-PXOIM2JE.js';
|
|
20
20
|
import { toStandardSchema, standardSchemaToJSONSchema, isStandardSchemaWithJSON } from './chunk-6SRTDZ7S.js';
|
|
21
21
|
import { MASTRA_THREAD_ID_KEY, MASTRA_RESOURCE_ID_KEY, RequestContext, MASTRA_VERSIONS_KEY, mergeVersionOverrides } from './chunk-4RQN7U3L.js';
|
|
22
22
|
import { MastraBase } from './chunk-WENZPAHS.js';
|
|
@@ -10342,7 +10342,9 @@ function createStep(params, agentOrToolOptions) {
|
|
|
10342
10342
|
return createStepFromParams(params);
|
|
10343
10343
|
}
|
|
10344
10344
|
if (isProcessor(params)) {
|
|
10345
|
-
|
|
10345
|
+
const step = createStepFromProcessor(params);
|
|
10346
|
+
step.providesSkillDiscovery = params.providesSkillDiscovery;
|
|
10347
|
+
return step;
|
|
10346
10348
|
}
|
|
10347
10349
|
throw new Error("Invalid input: expected StepParams, Agent, ToolStep, or Processor");
|
|
10348
10350
|
}
|
|
@@ -20194,6 +20196,7 @@ var AgentLegacyHandler = class {
|
|
|
20194
20196
|
writableStream,
|
|
20195
20197
|
methodType,
|
|
20196
20198
|
tracingOptions,
|
|
20199
|
+
inputProcessors,
|
|
20197
20200
|
...rest
|
|
20198
20201
|
}) {
|
|
20199
20202
|
const observabilityContext = resolveObservabilityContext(rest);
|
|
@@ -20230,7 +20233,7 @@ var AgentLegacyHandler = class {
|
|
|
20230
20233
|
const innerObservabilityContext = createObservabilityContext({ currentSpan: agentSpan });
|
|
20231
20234
|
const memory = await this.capabilities.getMemory({ requestContext });
|
|
20232
20235
|
const threadId = thread?.id;
|
|
20233
|
-
|
|
20236
|
+
let convertedTools = await this.capabilities.convertTools({
|
|
20234
20237
|
toolsets,
|
|
20235
20238
|
clientTools,
|
|
20236
20239
|
threadId,
|
|
@@ -20240,7 +20243,8 @@ var AgentLegacyHandler = class {
|
|
|
20240
20243
|
...innerObservabilityContext,
|
|
20241
20244
|
writableStream,
|
|
20242
20245
|
methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
|
|
20243
|
-
memoryConfig
|
|
20246
|
+
memoryConfig,
|
|
20247
|
+
inputProcessors
|
|
20244
20248
|
});
|
|
20245
20249
|
let messageList = new MessageList({
|
|
20246
20250
|
threadId,
|
|
@@ -20254,15 +20258,24 @@ var AgentLegacyHandler = class {
|
|
|
20254
20258
|
const { tripwire: tripwire2 } = await this.capabilities.__runInputProcessors({
|
|
20255
20259
|
requestContext,
|
|
20256
20260
|
...innerObservabilityContext,
|
|
20257
|
-
messageList
|
|
20261
|
+
messageList,
|
|
20262
|
+
inputProcessorOverrides: inputProcessors
|
|
20258
20263
|
});
|
|
20259
20264
|
if (!tripwire2) {
|
|
20260
20265
|
const inputStepResult = await this.capabilities.__runProcessInputStep({
|
|
20261
20266
|
requestContext,
|
|
20262
20267
|
...innerObservabilityContext,
|
|
20263
20268
|
messageList,
|
|
20264
|
-
stepNumber: 0
|
|
20269
|
+
stepNumber: 0,
|
|
20270
|
+
inputProcessorOverrides: inputProcessors,
|
|
20271
|
+
tools: convertedTools,
|
|
20272
|
+
runId,
|
|
20273
|
+
threadId,
|
|
20274
|
+
resourceId
|
|
20265
20275
|
});
|
|
20276
|
+
if (inputStepResult.tools) {
|
|
20277
|
+
convertedTools = inputStepResult.tools;
|
|
20278
|
+
}
|
|
20266
20279
|
if (inputStepResult.tripwire) {
|
|
20267
20280
|
return {
|
|
20268
20281
|
messageObjects: [],
|
|
@@ -20331,7 +20344,8 @@ var AgentLegacyHandler = class {
|
|
|
20331
20344
|
const { messageList: processedMessageList, tripwire } = await this.capabilities.__runInputProcessors({
|
|
20332
20345
|
requestContext,
|
|
20333
20346
|
...innerObservabilityContext,
|
|
20334
|
-
messageList
|
|
20347
|
+
messageList,
|
|
20348
|
+
inputProcessorOverrides: inputProcessors
|
|
20335
20349
|
});
|
|
20336
20350
|
messageList = processedMessageList;
|
|
20337
20351
|
if (!tripwire) {
|
|
@@ -20339,8 +20353,16 @@ var AgentLegacyHandler = class {
|
|
|
20339
20353
|
requestContext,
|
|
20340
20354
|
...innerObservabilityContext,
|
|
20341
20355
|
messageList,
|
|
20342
|
-
stepNumber: 0
|
|
20356
|
+
stepNumber: 0,
|
|
20357
|
+
inputProcessorOverrides: inputProcessors,
|
|
20358
|
+
tools: convertedTools,
|
|
20359
|
+
runId,
|
|
20360
|
+
threadId,
|
|
20361
|
+
resourceId
|
|
20343
20362
|
});
|
|
20363
|
+
if (inputStepResult.tools) {
|
|
20364
|
+
convertedTools = inputStepResult.tools;
|
|
20365
|
+
}
|
|
20344
20366
|
if (inputStepResult.tripwire) {
|
|
20345
20367
|
return {
|
|
20346
20368
|
convertedTools,
|
|
@@ -20570,6 +20592,7 @@ var AgentLegacyHandler = class {
|
|
|
20570
20592
|
tracingOptions,
|
|
20571
20593
|
savePerStep,
|
|
20572
20594
|
writableStream,
|
|
20595
|
+
inputProcessors,
|
|
20573
20596
|
...args
|
|
20574
20597
|
} = options;
|
|
20575
20598
|
const resourceIdFromContext = requestContext.get(MASTRA_RESOURCE_ID_KEY);
|
|
@@ -20613,6 +20636,7 @@ var AgentLegacyHandler = class {
|
|
|
20613
20636
|
writableStream,
|
|
20614
20637
|
methodType,
|
|
20615
20638
|
tracingOptions,
|
|
20639
|
+
inputProcessors,
|
|
20616
20640
|
...resolveObservabilityContext(args)
|
|
20617
20641
|
});
|
|
20618
20642
|
let messageList;
|
|
@@ -22002,7 +22026,8 @@ function createPrepareToolsStep({
|
|
|
22002
22026
|
memoryConfig: options.memory?.options,
|
|
22003
22027
|
autoResumeSuspendedTools: options.autoResumeSuspendedTools,
|
|
22004
22028
|
delegation: options.delegation,
|
|
22005
|
-
backgroundTaskEnabled
|
|
22029
|
+
backgroundTaskEnabled,
|
|
22030
|
+
inputProcessors: options.inputProcessors
|
|
22006
22031
|
});
|
|
22007
22032
|
const toolNames = Object.keys(convertedTools);
|
|
22008
22033
|
if (toolNames.length > 0) {
|
|
@@ -22188,6 +22213,50 @@ function resolveMaybePromise(value, cb) {
|
|
|
22188
22213
|
}
|
|
22189
22214
|
return cb(value);
|
|
22190
22215
|
}
|
|
22216
|
+
function hasConfiguredProcessor(processors, predicate) {
|
|
22217
|
+
return processors.some((processor) => {
|
|
22218
|
+
const maybeWorkflow = processor;
|
|
22219
|
+
const isWorkflowLike = isProcessorWorkflow(processor);
|
|
22220
|
+
const workflowSteps = [
|
|
22221
|
+
...Object.values(maybeWorkflow.steps ?? {}),
|
|
22222
|
+
...(maybeWorkflow.stepGraph ?? []).flatMap((entry) => {
|
|
22223
|
+
if (entry.type === "step") {
|
|
22224
|
+
return entry.step ? [entry.step] : [];
|
|
22225
|
+
}
|
|
22226
|
+
return entry.steps?.map((stepEntry) => stepEntry.step).filter(Boolean) ?? [];
|
|
22227
|
+
})
|
|
22228
|
+
];
|
|
22229
|
+
if (!isWorkflowLike || workflowSteps.length === 0) {
|
|
22230
|
+
const processorId = typeof processor.id === "string" && processor.id.startsWith("processor:") ? processor.id.slice("processor:".length) : processor.id;
|
|
22231
|
+
return predicate({
|
|
22232
|
+
...processor,
|
|
22233
|
+
id: processorId,
|
|
22234
|
+
providesSkillDiscovery: processor.providesSkillDiscovery
|
|
22235
|
+
});
|
|
22236
|
+
}
|
|
22237
|
+
return workflowSteps.some((step) => {
|
|
22238
|
+
if (isProcessorWorkflow(step)) {
|
|
22239
|
+
return hasConfiguredProcessor([step], predicate);
|
|
22240
|
+
}
|
|
22241
|
+
const stepId = typeof step.id === "string" ? step.id : void 0;
|
|
22242
|
+
if (!stepId?.startsWith("processor:")) {
|
|
22243
|
+
return false;
|
|
22244
|
+
}
|
|
22245
|
+
const processorId = stepId.slice("processor:".length);
|
|
22246
|
+
const workflowStep = step;
|
|
22247
|
+
return predicate({
|
|
22248
|
+
id: processorId,
|
|
22249
|
+
providesSkillDiscovery: workflowStep.providesSkillDiscovery
|
|
22250
|
+
});
|
|
22251
|
+
});
|
|
22252
|
+
});
|
|
22253
|
+
}
|
|
22254
|
+
function hasEagerSkillsProcessor(processors) {
|
|
22255
|
+
return hasConfiguredProcessor(processors, (processor) => processor.id === "skills-processor");
|
|
22256
|
+
}
|
|
22257
|
+
function hasOnDemandSkillDiscoveryProcessor(processors) {
|
|
22258
|
+
return hasConfiguredProcessor(processors, (processor) => processor.providesSkillDiscovery === "on-demand");
|
|
22259
|
+
}
|
|
22191
22260
|
var Agent = class _Agent extends MastraBase {
|
|
22192
22261
|
id;
|
|
22193
22262
|
name;
|
|
@@ -22516,10 +22585,9 @@ var Agent = class _Agent extends MastraBase {
|
|
|
22516
22585
|
if (!workspace?.skills) {
|
|
22517
22586
|
return [];
|
|
22518
22587
|
}
|
|
22519
|
-
const hasSkillsProcessor = configuredProcessors
|
|
22520
|
-
|
|
22521
|
-
)
|
|
22522
|
-
if (hasSkillsProcessor) {
|
|
22588
|
+
const hasSkillsProcessor = hasEagerSkillsProcessor(configuredProcessors);
|
|
22589
|
+
const hasOnDemandProcessor = hasOnDemandSkillDiscoveryProcessor(configuredProcessors);
|
|
22590
|
+
if (hasSkillsProcessor || hasOnDemandProcessor) {
|
|
22523
22591
|
return [];
|
|
22524
22592
|
}
|
|
22525
22593
|
return [new SkillsProcessor({ workspace, format: this.#skillsFormat })];
|
|
@@ -24085,6 +24153,7 @@ ${errorMessages}`,
|
|
|
24085
24153
|
mastraProxy,
|
|
24086
24154
|
autoResumeSuspendedTools,
|
|
24087
24155
|
backgroundTaskEnabled,
|
|
24156
|
+
suppressEagerSkillTools,
|
|
24088
24157
|
...rest
|
|
24089
24158
|
}) {
|
|
24090
24159
|
const observabilityContext = resolveObservabilityContext(rest);
|
|
@@ -24100,6 +24169,9 @@ ${errorMessages}`,
|
|
|
24100
24169
|
if (Object.keys(skillTools).length > 0) {
|
|
24101
24170
|
this.logger.debug("Adding skill tools", { agent: this.name, tools: Object.keys(skillTools), runId });
|
|
24102
24171
|
for (const [toolName, tool2] of Object.entries(skillTools)) {
|
|
24172
|
+
if (suppressEagerSkillTools && (toolName === "skill" || toolName === "skill_search")) {
|
|
24173
|
+
continue;
|
|
24174
|
+
}
|
|
24103
24175
|
const toolObj = tool2;
|
|
24104
24176
|
const options = {
|
|
24105
24177
|
name: toolName,
|
|
@@ -24246,18 +24318,34 @@ ${errorMessages}`,
|
|
|
24246
24318
|
* @internal
|
|
24247
24319
|
*/
|
|
24248
24320
|
async __runProcessInputStep(args) {
|
|
24249
|
-
const {
|
|
24321
|
+
const {
|
|
24322
|
+
requestContext,
|
|
24323
|
+
messageList,
|
|
24324
|
+
stepNumber = 0,
|
|
24325
|
+
inputProcessorOverrides,
|
|
24326
|
+
processorStates,
|
|
24327
|
+
tools,
|
|
24328
|
+
runId,
|
|
24329
|
+
threadId,
|
|
24330
|
+
resourceId,
|
|
24331
|
+
outputWriter,
|
|
24332
|
+
autoResumeSuspendedTools,
|
|
24333
|
+
backgroundTaskEnabled,
|
|
24334
|
+
...rest
|
|
24335
|
+
} = args;
|
|
24250
24336
|
const observabilityContext = resolveObservabilityContext(rest);
|
|
24251
24337
|
let tripwire;
|
|
24252
|
-
|
|
24338
|
+
let nextTools = tools;
|
|
24339
|
+
if (inputProcessorOverrides?.length || this.#inputProcessors || this.#memory) {
|
|
24253
24340
|
const runner = await this.getProcessorRunner({
|
|
24254
24341
|
requestContext,
|
|
24342
|
+
inputProcessorOverrides,
|
|
24255
24343
|
processorStates
|
|
24256
24344
|
});
|
|
24257
24345
|
try {
|
|
24258
24346
|
const llm = await this.getLLM({ requestContext });
|
|
24259
24347
|
const model = llm.getModel();
|
|
24260
|
-
await runner.runProcessInputStep({
|
|
24348
|
+
const result = await runner.runProcessInputStep({
|
|
24261
24349
|
messageList,
|
|
24262
24350
|
stepNumber,
|
|
24263
24351
|
steps: [],
|
|
@@ -24266,8 +24354,47 @@ ${errorMessages}`,
|
|
|
24266
24354
|
// Cast needed: legacy v1 models return LanguageModelV1 which doesn't satisfy MastraLanguageModel.
|
|
24267
24355
|
// OM's processInputStep doesn't use the model parameter, so this is safe.
|
|
24268
24356
|
model,
|
|
24357
|
+
tools,
|
|
24269
24358
|
retryCount: 0
|
|
24270
24359
|
});
|
|
24360
|
+
if (result.tools) {
|
|
24361
|
+
const workspace = await this.getWorkspace({ requestContext });
|
|
24362
|
+
const memory = await this.getMemory({ requestContext });
|
|
24363
|
+
const mastraProxy = this.#mastra ? createMastraProxy({ mastra: this.#mastra, logger: this.logger }) : void 0;
|
|
24364
|
+
const convertedTools = {};
|
|
24365
|
+
for (const [name, tool2] of Object.entries(result.tools)) {
|
|
24366
|
+
if (isMastraTool(tool2) || isProviderTool(tool2)) {
|
|
24367
|
+
convertedTools[name] = makeCoreTool(
|
|
24368
|
+
tool2,
|
|
24369
|
+
{
|
|
24370
|
+
name,
|
|
24371
|
+
runId,
|
|
24372
|
+
threadId,
|
|
24373
|
+
resourceId,
|
|
24374
|
+
logger: this.logger,
|
|
24375
|
+
mastra: mastraProxy,
|
|
24376
|
+
memory,
|
|
24377
|
+
agentName: this.name,
|
|
24378
|
+
agentId: this.id,
|
|
24379
|
+
requestContext,
|
|
24380
|
+
...observabilityContext,
|
|
24381
|
+
model: await this.getModel({ requestContext }),
|
|
24382
|
+
outputWriter,
|
|
24383
|
+
tracingPolicy: this.#options?.tracingPolicy,
|
|
24384
|
+
requireApproval: tool2.requireApproval,
|
|
24385
|
+
backgroundConfig: tool2.background,
|
|
24386
|
+
workspace
|
|
24387
|
+
},
|
|
24388
|
+
void 0,
|
|
24389
|
+
autoResumeSuspendedTools,
|
|
24390
|
+
backgroundTaskEnabled
|
|
24391
|
+
);
|
|
24392
|
+
} else {
|
|
24393
|
+
convertedTools[name] = tool2;
|
|
24394
|
+
}
|
|
24395
|
+
}
|
|
24396
|
+
nextTools = convertedTools;
|
|
24397
|
+
}
|
|
24271
24398
|
} catch (error) {
|
|
24272
24399
|
if (error instanceof TripWire) {
|
|
24273
24400
|
tripwire = {
|
|
@@ -24297,6 +24424,7 @@ ${errorMessages}`,
|
|
|
24297
24424
|
}
|
|
24298
24425
|
return {
|
|
24299
24426
|
messageList,
|
|
24427
|
+
tools: nextTools,
|
|
24300
24428
|
tripwire
|
|
24301
24429
|
};
|
|
24302
24430
|
}
|
|
@@ -25554,6 +25682,7 @@ ${effectiveInstructions}`;
|
|
|
25554
25682
|
autoResumeSuspendedTools,
|
|
25555
25683
|
delegation,
|
|
25556
25684
|
backgroundTaskEnabled,
|
|
25685
|
+
inputProcessors,
|
|
25557
25686
|
...rest
|
|
25558
25687
|
}) {
|
|
25559
25688
|
const observabilityContext = resolveObservabilityContext(rest);
|
|
@@ -25635,6 +25764,9 @@ ${effectiveInstructions}`;
|
|
|
25635
25764
|
autoResumeSuspendedTools,
|
|
25636
25765
|
backgroundTaskEnabled
|
|
25637
25766
|
});
|
|
25767
|
+
const configuredInputProcessors = inputProcessors ?? await this.listConfiguredInputProcessors(requestContext);
|
|
25768
|
+
const hasOnDemandProcessor = hasOnDemandSkillDiscoveryProcessor(configuredInputProcessors);
|
|
25769
|
+
const hasSkillsProcessor = hasEagerSkillsProcessor(configuredInputProcessors);
|
|
25638
25770
|
const skillTools = await this.listSkillTools({
|
|
25639
25771
|
runId,
|
|
25640
25772
|
resourceId,
|
|
@@ -25643,7 +25775,8 @@ ${effectiveInstructions}`;
|
|
|
25643
25775
|
...observabilityContext,
|
|
25644
25776
|
mastraProxy,
|
|
25645
25777
|
autoResumeSuspendedTools,
|
|
25646
|
-
backgroundTaskEnabled
|
|
25778
|
+
backgroundTaskEnabled,
|
|
25779
|
+
suppressEagerSkillTools: hasOnDemandProcessor && !hasSkillsProcessor
|
|
25647
25780
|
});
|
|
25648
25781
|
const channelTools = await this.listChannelTools({
|
|
25649
25782
|
runId,
|
|
@@ -29519,6 +29652,7 @@ var SkillSearchProcessor = class {
|
|
|
29519
29652
|
id = "skill-search";
|
|
29520
29653
|
name = "Skill Search Processor";
|
|
29521
29654
|
description = "Enables on-demand skill discovery and loading via search";
|
|
29655
|
+
providesSkillDiscovery = "on-demand";
|
|
29522
29656
|
workspace;
|
|
29523
29657
|
searchConfig;
|
|
29524
29658
|
ttl;
|
|
@@ -29660,7 +29794,7 @@ var SkillSearchProcessor = class {
|
|
|
29660
29794
|
id: "search_skills",
|
|
29661
29795
|
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.",
|
|
29662
29796
|
inputSchema: z.object({
|
|
29663
|
-
query: z.string().describe('Search keywords (e.g., "api design", "testing", "deployment")')
|
|
29797
|
+
query: z.string().trim().min(1, "Query is required").describe('Search keywords (e.g., "api design", "testing", "deployment")')
|
|
29664
29798
|
}),
|
|
29665
29799
|
outputSchema: z.object({
|
|
29666
29800
|
results: z.array(
|
|
@@ -31783,5 +31917,5 @@ var MockMemory = class extends MastraMemory {
|
|
|
31783
31917
|
};
|
|
31784
31918
|
|
|
31785
31919
|
export { Agent, AgentChannels, AgentsMDInjector, BaseProcessor, BatchPartsProcessor, ChatChannelProcessor, ChunkFrom, DefaultExecutionEngine, ExecutionEngine, FilePartSchema, ImagePartSchema, LanguageDetector, MastraAgentNetworkStream, MastraMemory, MastraModelOutput, MastraScorer, MastraStateAdapter, MemoryProcessor, MessageContentSchema, MessageHistory, MessagePartSchema, MockMemory, ModerationProcessor, PIIDetector, PrefillErrorHandler, ProcessorInputPhaseSchema, ProcessorInputStepPhaseSchema, ProcessorMessageContentSchema, ProcessorMessageSchema, ProcessorOutputResultPhaseSchema, ProcessorOutputStepPhaseSchema, ProcessorOutputStreamPhaseSchema, ProcessorRunner, ProcessorState, ProcessorStepInputSchema, ProcessorStepOutputSchema, ProcessorStepSchema, PromptInjectionDetector, ProviderHistoryCompat, ReasoningPartSchema, Run, SYSTEM_REMINDER_END_TAG, SYSTEM_REMINDER_START_TAG, SaveQueueManager, SemanticRecall, SkillSearchProcessor, SkillsProcessor, SourcePartSchema, StepStartPartSchema, StreamErrorRetryProcessor, StructuredOutputProcessor, SystemPromptScrubber, TextPartSchema, TokenLimiterProcessor, ToolCallFilter, ToolInvocationPartSchema, ToolSearchProcessor, TripWire, UnicodeNormalizer, WORKING_MEMORY_END_TAG, WORKING_MEMORY_START_TAG, Workflow, WorkflowRunOutput, WorkingMemory, WorkspaceInstructionsProcessor, anthropicToolIdFormat, augmentWithInit, cleanStepResult, cloneStep, cloneWorkflow, convertFullStreamChunkToMastra, convertFullStreamChunkToUIMessageStream, convertMastraChunkToAISDKv5, createCachingTransformStream, createDeprecationProxy, createReplayStream, createScorer, createStep, createTimeTravelExecutionParams, createWorkflow, execute, extractWorkingMemoryContent, extractWorkingMemoryTags, filterRun, filterSystemReminderMessages, formatCheckFeedback, formatCompletionFeedback, formatStreamCompletionFeedback, formatValidationFeedback, forwardAgentStreamChunk, generateFinalResult, generateStructuredFinalResult, getResumeLabelsByStepId, getStepIds, getStepResult, getThreadOMMetadata, globalEmbeddingCache, hydrateSerializedStepErrors, isDurableAgentLike, isObservationalMemoryEnabled, isProcessor, isProcessorWorkflow, isRetryableOpenAIResponsesStreamError, isSupportedLanguageModel, isSystemReminderMessage, loop, mapVariable, memoryDefaultOptions, parseMemoryRequestContext, removeSystemReminderTags, removeWorkingMemoryTags, resolveThreadIdFromArgs, runChecks, runCompletionScorers, runCountDeprecationMessage, runDefaultCompletionCheck, runScorer, runStreamCompletionScorers, runValidation, setThreadOMMetadata, summarizeActiveToolsForSpan, summarizeProcessorModelForSpan, summarizeProcessorResultForSpan, summarizeProcessorToolsForSpan, summarizeToolChoiceForSpan, supportedLanguageModelSpecifications, tryGenerateWithJsonFallback, tryStreamWithJsonFallback, validateStepInput, validateStepRequestContext, validateStepResumeData, validateStepStateData, validateStepSuspendData, withStreamCaching };
|
|
31786
|
-
//# sourceMappingURL=chunk-
|
|
31787
|
-
//# sourceMappingURL=chunk-
|
|
31920
|
+
//# sourceMappingURL=chunk-4SXW4BMV.js.map
|
|
31921
|
+
//# sourceMappingURL=chunk-4SXW4BMV.js.map
|