@mastra/editor 0.7.24-alpha.1 → 0.7.24-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/editor
2
2
 
3
+ ## 0.7.24-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`b560d6f`](https://github.com/mastra-ai/mastra/commit/b560d6f88b9b904b15c10f75c949eb145bc27684), [`36b3bbf`](https://github.com/mastra-ai/mastra/commit/36b3bbf5a8d59f7e23d47e29340e76c681b4929c), [`b275631`](https://github.com/mastra-ai/mastra/commit/b275631dc10541a482b2e2d4a3e3cfa843bd5fa1)]:
8
+ - @mastra/core@1.33.0-alpha.6
9
+ - @mastra/memory@1.17.6-alpha.1
10
+
11
+ ## 0.7.24-alpha.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Fixed `@mastra/editor` integrations (Composio, Arcade) collapsing every tool call onto a shared `'default'` user. Tools resolved during `agent.generate` now scope to the authenticated resource from the request context, so per-user OAuth connections route to the correct account instead of a shared one. ([#16122](https://github.com/mastra-ai/mastra/pull/16122))
16
+
3
17
  ## 0.7.24-alpha.1
4
18
 
5
19
  ### Patch Changes
package/dist/arcade.cjs CHANGED
@@ -25,6 +25,7 @@ __export(arcade_exports, {
25
25
  module.exports = __toCommonJS(arcade_exports);
26
26
 
27
27
  // src/providers/arcade.ts
28
+ var import_request_context = require("@mastra/core/request-context");
28
29
  var import_arcadejs = require("@arcadeai/arcadejs");
29
30
  var import_lib = require("@arcadeai/arcadejs/lib/index");
30
31
  var KNOWN_TOOLKITS = [
@@ -254,7 +255,8 @@ var ArcadeToolProvider = class {
254
255
  async resolveTools(toolSlugs, toolConfigs, options) {
255
256
  if (toolSlugs.length === 0) return {};
256
257
  const client = this.getClient();
257
- const userId = options?.userId ?? "default";
258
+ const resourceId = options?.requestContext?.[import_request_context.MASTRA_RESOURCE_ID_KEY];
259
+ const userId = typeof resourceId === "string" ? resourceId : options?.userId ?? "default";
258
260
  const toolDefs = await Promise.all(toolSlugs.map((slug) => client.tools.get(slug).catch(() => null)));
259
261
  const validDefs = toolDefs.filter((d) => d !== null);
260
262
  if (validDefs.length === 0) return {};
package/dist/arcade.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/providers/arcade.ts
2
+ import { MASTRA_RESOURCE_ID_KEY } from "@mastra/core/request-context";
2
3
  import { Arcade } from "@arcadeai/arcadejs";
3
4
  import { toZodToolSet, executeOrAuthorizeZodTool } from "@arcadeai/arcadejs/lib/index";
4
5
  var KNOWN_TOOLKITS = [
@@ -228,7 +229,8 @@ var ArcadeToolProvider = class {
228
229
  async resolveTools(toolSlugs, toolConfigs, options) {
229
230
  if (toolSlugs.length === 0) return {};
230
231
  const client = this.getClient();
231
- const userId = options?.userId ?? "default";
232
+ const resourceId = options?.requestContext?.[MASTRA_RESOURCE_ID_KEY];
233
+ const userId = typeof resourceId === "string" ? resourceId : options?.userId ?? "default";
232
234
  const toolDefs = await Promise.all(toolSlugs.map((slug) => client.tools.get(slug).catch(() => null)));
233
235
  const validDefs = toolDefs.filter((d) => d !== null);
234
236
  if (validDefs.length === 0) return {};
package/dist/composio.cjs CHANGED
@@ -25,6 +25,7 @@ __export(composio_exports, {
25
25
  module.exports = __toCommonJS(composio_exports);
26
26
 
27
27
  // src/providers/composio.ts
28
+ var import_request_context = require("@mastra/core/request-context");
28
29
  var import_core = require("@composio/core");
29
30
  var import_mastra = require("@composio/mastra");
30
31
  var ComposioToolProvider = class {
@@ -119,7 +120,8 @@ var ComposioToolProvider = class {
119
120
  */
120
121
  async resolveTools(toolSlugs, toolConfigs, options) {
121
122
  if (toolSlugs.length === 0) return {};
122
- const userId = options?.userId ?? "default";
123
+ const resourceId = options?.requestContext?.[import_request_context.MASTRA_RESOURCE_ID_KEY];
124
+ const userId = typeof resourceId === "string" ? resourceId : options?.userId ?? "default";
123
125
  const composio = this.getMastraClient();
124
126
  const mastraTools = await composio.tools.get(userId, { tools: toolSlugs });
125
127
  const result = {};
package/dist/composio.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/providers/composio.ts
2
+ import { MASTRA_RESOURCE_ID_KEY } from "@mastra/core/request-context";
2
3
  import { Composio } from "@composio/core";
3
4
  import { MastraProvider } from "@composio/mastra";
4
5
  var ComposioToolProvider = class {
@@ -93,7 +94,8 @@ var ComposioToolProvider = class {
93
94
  */
94
95
  async resolveTools(toolSlugs, toolConfigs, options) {
95
96
  if (toolSlugs.length === 0) return {};
96
- const userId = options?.userId ?? "default";
97
+ const resourceId = options?.requestContext?.[MASTRA_RESOURCE_ID_KEY];
98
+ const userId = typeof resourceId === "string" ? resourceId : options?.userId ?? "default";
97
99
  const composio = this.getMastraClient();
98
100
  const mastraTools = await composio.tools.get(userId, { tools: toolSlugs });
99
101
  const result = {};
package/dist/index.cjs CHANGED
@@ -695,7 +695,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
695
695
  const hasConditionalTools = this.isConditionalVariants(storedConfig.tools);
696
696
  const hasConditionalMCPClients = storedConfig.mcpClients != null && this.isConditionalVariants(storedConfig.mcpClients);
697
697
  const hasConditionalIntegrationTools = storedConfig.integrationTools != null && this.isConditionalVariants(storedConfig.integrationTools);
698
- const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools;
698
+ const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasStoredIntegrationTools;
699
699
  if (isDynamicTools) {
700
700
  const originalTools = fork.listTools.bind(fork);
701
701
  const toolsFn = async ({ requestContext: requestContext2 }) => {
@@ -715,7 +715,10 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
715
715
  storedConfig.integrationTools,
716
716
  ctx
717
717
  ) : storedConfig.integrationTools;
718
- const integrationTools = await this.resolveStoredIntegrationTools(resolvedIntegrationToolsConfig, ctx);
718
+ const integrationTools = await this.resolveStoredIntegrationTools(
719
+ resolvedIntegrationToolsConfig,
720
+ requestContext2
721
+ );
719
722
  return { ...codeTools, ...registryTools, ...mcpTools, ...integrationTools };
720
723
  };
721
724
  fork.__setTools(toolsFn);
@@ -797,7 +800,8 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
797
800
  const hasConditionalDefaultOptions = storedAgent.defaultOptions != null && this.isConditionalVariants(storedAgent.defaultOptions);
798
801
  const hasConditionalModel = this.isConditionalVariants(storedAgent.model);
799
802
  const hasConditionalWorkspace = storedAgent.workspace != null && this.isConditionalVariants(storedAgent.workspace);
800
- const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools;
803
+ const hasIntegrationTools = storedAgent.integrationTools != null;
804
+ const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasIntegrationTools;
801
805
  let tools;
802
806
  if (isDynamicTools) {
803
807
  tools = async ({ requestContext }) => {
@@ -816,7 +820,10 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
816
820
  storedAgent.integrationTools,
817
821
  ctx
818
822
  ) : storedAgent.integrationTools;
819
- const integrationTools = await this.resolveStoredIntegrationTools(resolvedIntegrationToolsConfig, ctx);
823
+ const integrationTools = await this.resolveStoredIntegrationTools(
824
+ resolvedIntegrationToolsConfig,
825
+ requestContext
826
+ );
820
827
  return { ...registryTools, ...mcpTools, ...integrationTools };
821
828
  };
822
829
  } else {
@@ -1122,6 +1129,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
1122
1129
  async resolveStoredIntegrationTools(integrationTools, requestContext) {
1123
1130
  if (!integrationTools || Object.keys(integrationTools).length === 0) return {};
1124
1131
  const allTools = {};
1132
+ const providerOptions = { requestContext: requestContext?.toJSON() };
1125
1133
  for (const [providerId, providerConfig] of Object.entries(integrationTools)) {
1126
1134
  try {
1127
1135
  if (!providerConfig.tools) continue;
@@ -1140,7 +1148,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
1140
1148
  } else {
1141
1149
  slugsToResolve = wantedSlugs;
1142
1150
  }
1143
- const providerTools = await provider.resolveTools(slugsToResolve, providerConfig.tools, { requestContext });
1151
+ const providerTools = await provider.resolveTools(slugsToResolve, providerConfig.tools, providerOptions);
1144
1152
  for (const [toolId, tool] of Object.entries(providerTools)) {
1145
1153
  const description = providerConfig.tools?.[toolId]?.description;
1146
1154
  if (description) {
package/dist/index.js CHANGED
@@ -647,7 +647,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
647
647
  const hasConditionalTools = this.isConditionalVariants(storedConfig.tools);
648
648
  const hasConditionalMCPClients = storedConfig.mcpClients != null && this.isConditionalVariants(storedConfig.mcpClients);
649
649
  const hasConditionalIntegrationTools = storedConfig.integrationTools != null && this.isConditionalVariants(storedConfig.integrationTools);
650
- const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools;
650
+ const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasStoredIntegrationTools;
651
651
  if (isDynamicTools) {
652
652
  const originalTools = fork.listTools.bind(fork);
653
653
  const toolsFn = async ({ requestContext: requestContext2 }) => {
@@ -667,7 +667,10 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
667
667
  storedConfig.integrationTools,
668
668
  ctx
669
669
  ) : storedConfig.integrationTools;
670
- const integrationTools = await this.resolveStoredIntegrationTools(resolvedIntegrationToolsConfig, ctx);
670
+ const integrationTools = await this.resolveStoredIntegrationTools(
671
+ resolvedIntegrationToolsConfig,
672
+ requestContext2
673
+ );
671
674
  return { ...codeTools, ...registryTools, ...mcpTools, ...integrationTools };
672
675
  };
673
676
  fork.__setTools(toolsFn);
@@ -749,7 +752,8 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
749
752
  const hasConditionalDefaultOptions = storedAgent.defaultOptions != null && this.isConditionalVariants(storedAgent.defaultOptions);
750
753
  const hasConditionalModel = this.isConditionalVariants(storedAgent.model);
751
754
  const hasConditionalWorkspace = storedAgent.workspace != null && this.isConditionalVariants(storedAgent.workspace);
752
- const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools;
755
+ const hasIntegrationTools = storedAgent.integrationTools != null;
756
+ const isDynamicTools = hasConditionalTools || hasConditionalMCPClients || hasConditionalIntegrationTools || hasIntegrationTools;
753
757
  let tools;
754
758
  if (isDynamicTools) {
755
759
  tools = async ({ requestContext }) => {
@@ -768,7 +772,10 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
768
772
  storedAgent.integrationTools,
769
773
  ctx
770
774
  ) : storedAgent.integrationTools;
771
- const integrationTools = await this.resolveStoredIntegrationTools(resolvedIntegrationToolsConfig, ctx);
775
+ const integrationTools = await this.resolveStoredIntegrationTools(
776
+ resolvedIntegrationToolsConfig,
777
+ requestContext
778
+ );
772
779
  return { ...registryTools, ...mcpTools, ...integrationTools };
773
780
  };
774
781
  } else {
@@ -1074,6 +1081,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
1074
1081
  async resolveStoredIntegrationTools(integrationTools, requestContext) {
1075
1082
  if (!integrationTools || Object.keys(integrationTools).length === 0) return {};
1076
1083
  const allTools = {};
1084
+ const providerOptions = { requestContext: requestContext?.toJSON() };
1077
1085
  for (const [providerId, providerConfig] of Object.entries(integrationTools)) {
1078
1086
  try {
1079
1087
  if (!providerConfig.tools) continue;
@@ -1092,7 +1100,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
1092
1100
  } else {
1093
1101
  slugsToResolve = wantedSlugs;
1094
1102
  }
1095
- const providerTools = await provider.resolveTools(slugsToResolve, providerConfig.tools, { requestContext });
1103
+ const providerTools = await provider.resolveTools(slugsToResolve, providerConfig.tools, providerOptions);
1096
1104
  for (const [toolId, tool] of Object.entries(providerTools)) {
1097
1105
  const description = providerConfig.tools?.[toolId]?.description;
1098
1106
  if (description) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/editor",
3
- "version": "0.7.24-alpha.1",
3
+ "version": "0.7.24-alpha.3",
4
4
  "description": "Mastra Editor for agent management and instantiation",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "@arcadeai/arcadejs": "^2.3.0",
66
66
  "@composio/core": "^0.6.5",
67
67
  "@composio/mastra": "^0.6.5",
68
- "@mastra/memory": "1.17.6-alpha.0",
68
+ "@mastra/memory": "1.17.6-alpha.1",
69
69
  "@mastra/schema-compat": "1.2.9"
70
70
  },
71
71
  "devDependencies": {
@@ -75,13 +75,13 @@
75
75
  "typescript": "^6.0.3",
76
76
  "vitest": "4.1.5",
77
77
  "zod": "^3.25.76",
78
- "@internal/ai-v6": "0.0.39",
79
78
  "@internal/ai-sdk-v4": "0.0.39",
80
79
  "@internal/ai-sdk-v5": "0.0.39",
81
- "@mastra/core": "1.33.0-alpha.0",
82
- "@mastra/libsql": "1.10.0",
83
- "@mastra/hono": "1.4.14-alpha.0",
84
- "@mastra/mcp": "1.7.0"
80
+ "@internal/ai-v6": "0.0.39",
81
+ "@mastra/libsql": "1.10.1-alpha.0",
82
+ "@mastra/core": "1.33.0-alpha.6",
83
+ "@mastra/mcp": "1.7.0",
84
+ "@mastra/hono": "1.4.14-alpha.6"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@mastra/core": ">=1.13.2-0 <2.0.0-0",