@mastra/editor 0.10.2-alpha.0 → 0.11.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 +72 -0
- package/dist/composio.cjs +280 -54
- package/dist/composio.cjs.map +1 -1
- package/dist/composio.d.cts +49 -38
- package/dist/composio.d.ts +49 -38
- package/dist/composio.js +280 -54
- package/dist/composio.js.map +1 -1
- package/dist/index.cjs +35 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -8
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { BUILT_IN_PROCESSOR_PROVIDERS } from "@mastra/core/processor-provider";
|
|
3
|
+
import { UnknownToolProviderError } from "@mastra/core/tool-provider";
|
|
3
4
|
|
|
4
5
|
// src/namespaces/base.ts
|
|
5
6
|
var EditorNamespace = class {
|
|
@@ -126,6 +127,7 @@ import { Agent } from "@mastra/core/agent";
|
|
|
126
127
|
import { CompositeVersionedSkillSource } from "@mastra/core/workspace";
|
|
127
128
|
import { convertSchemaToZod } from "@mastra/schema-compat";
|
|
128
129
|
import { RequestContext } from "@mastra/core/request-context";
|
|
130
|
+
import { resolveStoredToolProviders } from "@mastra/core/tool-provider";
|
|
129
131
|
|
|
130
132
|
// src/rule-evaluator.ts
|
|
131
133
|
function resolvePath(context, path) {
|
|
@@ -731,11 +733,13 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
731
733
|
const hasStoredTools = storedConfig.tools != null;
|
|
732
734
|
const hasStoredMCPClients = storedConfig.mcpClients != null;
|
|
733
735
|
const hasStoredIntegrationTools = storedConfig.integrationTools != null;
|
|
734
|
-
|
|
736
|
+
const hasStoredToolProviders = storedConfig.toolProviders != null && Object.keys(storedConfig.toolProviders).length > 0;
|
|
737
|
+
if (hasStoredTools || hasStoredMCPClients || hasStoredIntegrationTools || hasStoredToolProviders) {
|
|
735
738
|
const hasConditionalTools = this.isConditionalVariants(storedConfig.tools);
|
|
736
739
|
const hasConditionalMCPClients = storedConfig.mcpClients != null && this.isConditionalVariants(storedConfig.mcpClients);
|
|
737
740
|
const hasConditionalIntegrationTools = storedConfig.integrationTools != null && this.isConditionalVariants(storedConfig.integrationTools);
|
|
738
|
-
const
|
|
741
|
+
const hasConditionalToolProviders = storedConfig.toolProviders != null && this.isConditionalVariants(storedConfig.toolProviders);
|
|
742
|
+
const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasStoredIntegrationTools || hasConditionalToolProviders || hasStoredToolProviders;
|
|
739
743
|
if (isDynamicTools) {
|
|
740
744
|
const originalTools = agent.listTools.bind(agent);
|
|
741
745
|
const toolsFn = async ({ requestContext: requestContext2 }) => {
|
|
@@ -759,7 +763,20 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
759
763
|
resolvedIntegrationToolsConfig,
|
|
760
764
|
requestContext2
|
|
761
765
|
);
|
|
762
|
-
|
|
766
|
+
const resolvedToolProvidersConfig = hasConditionalToolProviders ? this.accumulateObjectVariants(
|
|
767
|
+
storedConfig.toolProviders,
|
|
768
|
+
ctx
|
|
769
|
+
) : storedConfig.toolProviders;
|
|
770
|
+
const providerTools = await resolveStoredToolProviders(
|
|
771
|
+
resolvedToolProvidersConfig,
|
|
772
|
+
(providerId) => this.editor.getToolProviderOrThrow(providerId),
|
|
773
|
+
{
|
|
774
|
+
requestContext: ctx,
|
|
775
|
+
authorId: storedConfig.authorId,
|
|
776
|
+
logger: this.logger
|
|
777
|
+
}
|
|
778
|
+
);
|
|
779
|
+
return { ...codeTools, ...registryTools, ...mcpTools, ...integrationTools, ...providerTools };
|
|
763
780
|
};
|
|
764
781
|
fork.__setTools(toolsFn);
|
|
765
782
|
} else {
|
|
@@ -831,6 +848,8 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
831
848
|
const hasConditionalTools = storedAgent.tools != null && this.isConditionalVariants(storedAgent.tools);
|
|
832
849
|
const hasConditionalMCPClients = storedAgent.mcpClients != null && this.isConditionalVariants(storedAgent.mcpClients);
|
|
833
850
|
const hasConditionalIntegrationTools = storedAgent.integrationTools != null && this.isConditionalVariants(storedAgent.integrationTools);
|
|
851
|
+
const hasToolProviders = storedAgent.toolProviders != null && Object.keys(storedAgent.toolProviders).length > 0;
|
|
852
|
+
const hasConditionalToolProviders = storedAgent.toolProviders != null && this.isConditionalVariants(storedAgent.toolProviders);
|
|
834
853
|
const hasConditionalWorkflows = storedAgent.workflows != null && this.isConditionalVariants(storedAgent.workflows);
|
|
835
854
|
const hasConditionalAgents = storedAgent.agents != null && this.isConditionalVariants(storedAgent.agents);
|
|
836
855
|
const hasConditionalMemory = storedAgent.memory != null && this.isConditionalVariants(storedAgent.memory);
|
|
@@ -842,7 +861,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
842
861
|
const hasConditionalWorkspace = storedAgent.workspace != null && this.isConditionalVariants(storedAgent.workspace);
|
|
843
862
|
const hasConditionalBrowser = storedAgent.browser != null && this.isConditionalVariants(storedAgent.browser);
|
|
844
863
|
const hasIntegrationTools = storedAgent.integrationTools != null;
|
|
845
|
-
const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasIntegrationTools;
|
|
864
|
+
const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasIntegrationTools || hasConditionalToolProviders || hasToolProviders;
|
|
846
865
|
let tools;
|
|
847
866
|
if (isDynamicTools) {
|
|
848
867
|
tools = async ({ requestContext }) => {
|
|
@@ -865,7 +884,17 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
865
884
|
resolvedIntegrationToolsConfig,
|
|
866
885
|
requestContext
|
|
867
886
|
);
|
|
868
|
-
|
|
887
|
+
const resolvedToolProvidersConfig = hasConditionalToolProviders ? this.accumulateObjectVariants(storedAgent.toolProviders, ctx) : storedAgent.toolProviders;
|
|
888
|
+
const providerTools = await resolveStoredToolProviders(
|
|
889
|
+
resolvedToolProvidersConfig,
|
|
890
|
+
(providerId) => this.editor.getToolProviderOrThrow(providerId),
|
|
891
|
+
{
|
|
892
|
+
requestContext: ctx,
|
|
893
|
+
authorId: storedAgent.authorId,
|
|
894
|
+
logger: this.logger
|
|
895
|
+
}
|
|
896
|
+
);
|
|
897
|
+
return { ...registryTools, ...mcpTools, ...integrationTools, ...providerTools };
|
|
869
898
|
};
|
|
870
899
|
} else {
|
|
871
900
|
const registryTools = this.resolveStoredTools(storedAgent.tools);
|
|
@@ -2374,9 +2403,7 @@ var MastraEditor = class {
|
|
|
2374
2403
|
getToolProviderOrThrow(id) {
|
|
2375
2404
|
const provider = this.__toolProviders[id];
|
|
2376
2405
|
if (!provider) {
|
|
2377
|
-
throw new
|
|
2378
|
-
`Unknown tool provider "${id}". Available: ${Object.keys(this.__toolProviders).join(", ") || "(none)"}`
|
|
2379
|
-
);
|
|
2406
|
+
throw new UnknownToolProviderError(id, Object.keys(this.__toolProviders));
|
|
2380
2407
|
}
|
|
2381
2408
|
return provider;
|
|
2382
2409
|
}
|