@mastra/editor 0.0.0-agent-chat-ui-20260305212602

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/LICENSE.md ADDED
@@ -0,0 +1,30 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ - All content that resides under any directory named "ee/" within this
4
+ repository, including but not limited to:
5
+ - `packages/core/src/auth/ee/`
6
+ - `packages/server/src/server/auth/ee/`
7
+ is licensed under the license defined in `ee/LICENSE`.
8
+
9
+ - All third-party components incorporated into the Mastra Software are
10
+ licensed under the original license provided by the owner of the
11
+ applicable component.
12
+
13
+ - Content outside of the above-mentioned directories or restrictions is
14
+ available under the "Apache License 2.0" as defined below.
15
+
16
+ # Apache License 2.0
17
+
18
+ Copyright (c) 2025 Kepler Software, Inc.
19
+
20
+ Licensed under the Apache License, Version 2.0 (the "License");
21
+ you may not use this file except in compliance with the License.
22
+ You may obtain a copy of the License at
23
+
24
+ http://www.apache.org/licenses/LICENSE-2.0
25
+
26
+ Unless required by applicable law or agreed to in writing, software
27
+ distributed under the License is distributed on an "AS IS" BASIS,
28
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
+ See the License for the specific language governing permissions and
30
+ limitations under the License.
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/arcade.ts
21
+ var arcade_exports = {};
22
+ __export(arcade_exports, {
23
+ ArcadeToolProvider: () => ArcadeToolProvider
24
+ });
25
+ module.exports = __toCommonJS(arcade_exports);
26
+
27
+ // src/providers/arcade.ts
28
+ var import_arcadejs = require("@arcadeai/arcadejs");
29
+ var import_lib = require("@arcadeai/arcadejs/lib/index");
30
+ var KNOWN_TOOLKITS = [
31
+ { slug: "AirtableApi", name: "Airtable API", category: "productivity" },
32
+ { slug: "ArcadeEngineApi", name: "Arcade Engine API", category: "development" },
33
+ { slug: "Asana", name: "Asana", category: "productivity" },
34
+ { slug: "AsanaApi", name: "Asana API", category: "productivity" },
35
+ { slug: "AshbyApi", name: "Ashby API", category: "productivity" },
36
+ { slug: "Attio", name: "Attio", category: "sales" },
37
+ { slug: "BoxApi", name: "Box API", category: "productivity" },
38
+ { slug: "Brightdata", name: "Bright Data", category: "development" },
39
+ { slug: "CalendlyApi", name: "Calendly API", category: "productivity" },
40
+ { slug: "Clickup", name: "ClickUp", category: "productivity" },
41
+ { slug: "ClickupApi", name: "ClickUp API", category: "productivity" },
42
+ { slug: "Confluence", name: "Confluence", category: "productivity" },
43
+ { slug: "CursorAgentsApi", name: "Cursor Agents API", category: "development" },
44
+ { slug: "CustomerioApi", name: "Customer.io API", category: "customer-support" },
45
+ { slug: "CustomerioPipelinesApi", name: "Customer.io Pipelines API", category: "customer-support" },
46
+ { slug: "CustomerioTrackApi", name: "Customer.io Track API", category: "customer-support" },
47
+ { slug: "DatadogApi", name: "Datadog API", category: "development" },
48
+ { slug: "Dropbox", name: "Dropbox", category: "productivity" },
49
+ { slug: "E2b", name: "E2B", category: "development" },
50
+ { slug: "ExaApi", name: "Exa API", category: "search" },
51
+ { slug: "Figma", name: "Figma", category: "productivity" },
52
+ { slug: "FigmaApi", name: "Figma API", category: "productivity" },
53
+ { slug: "Firecrawl", name: "Firecrawl", category: "development" },
54
+ { slug: "FreshserviceApi", name: "Freshservice API", category: "customer-support" },
55
+ { slug: "Github", name: "GitHub", category: "development" },
56
+ { slug: "GithubApi", name: "GitHub API", category: "development" },
57
+ { slug: "Gmail", name: "Gmail", category: "productivity" },
58
+ { slug: "Google", name: "Google", category: "search" },
59
+ { slug: "GoogleCalendar", name: "Google Calendar", category: "productivity" },
60
+ { slug: "GoogleContacts", name: "Google Contacts", category: "productivity" },
61
+ { slug: "GoogleDocs", name: "Google Docs", category: "productivity" },
62
+ { slug: "GoogleDrive", name: "Google Drive", category: "productivity" },
63
+ { slug: "GoogleFinance", name: "Google Finance", category: "search" },
64
+ { slug: "GoogleFlights", name: "Google Flights", category: "search" },
65
+ { slug: "GoogleHotels", name: "Google Hotels", category: "search" },
66
+ { slug: "GoogleJobs", name: "Google Jobs", category: "search" },
67
+ { slug: "GoogleMaps", name: "Google Maps", category: "search" },
68
+ { slug: "GoogleNews", name: "Google News", category: "search" },
69
+ { slug: "GoogleSearch", name: "Google Search", category: "search" },
70
+ { slug: "GoogleSheets", name: "Google Sheets", category: "productivity" },
71
+ { slug: "GoogleShopping", name: "Google Shopping", category: "search" },
72
+ { slug: "GoogleSlides", name: "Google Slides", category: "productivity" },
73
+ { slug: "Hubspot", name: "HubSpot", category: "sales" },
74
+ { slug: "HubspotAutomationApi", name: "HubSpot Automation API", category: "sales" },
75
+ { slug: "HubspotCmsApi", name: "HubSpot CMS API", category: "sales" },
76
+ { slug: "HubspotConversationsApi", name: "HubSpot Conversations API", category: "sales" },
77
+ { slug: "HubspotCrmApi", name: "HubSpot CRM API", category: "sales" },
78
+ { slug: "HubspotEventsApi", name: "HubSpot Events API", category: "sales" },
79
+ { slug: "HubspotMarketingApi", name: "HubSpot Marketing API", category: "sales" },
80
+ { slug: "HubspotMeetingsApi", name: "HubSpot Meetings API", category: "sales" },
81
+ { slug: "HubspotUsersApi", name: "HubSpot Users API", category: "sales" },
82
+ { slug: "Imgflip", name: "Imgflip", category: "entertainment" },
83
+ { slug: "IntercomApi", name: "Intercom API", category: "customer-support" },
84
+ { slug: "Jira", name: "Jira", category: "productivity" },
85
+ { slug: "Linear", name: "Linear", category: "productivity" },
86
+ { slug: "Linkedin", name: "LinkedIn", category: "social" },
87
+ { slug: "LumaApi", name: "Luma API", category: "productivity" },
88
+ { slug: "MailchimpMarketingApi", name: "Mailchimp API", category: "productivity" },
89
+ { slug: "Math", name: "Math", category: "utility" },
90
+ { slug: "Microsoft", name: "Microsoft", category: "productivity" },
91
+ { slug: "MicrosoftOnedrive", name: "Microsoft OneDrive", category: "productivity" },
92
+ { slug: "MicrosoftTeams", name: "Microsoft Teams", category: "social" },
93
+ { slug: "MicrosoftWord", name: "Microsoft Word", category: "productivity" },
94
+ { slug: "MiroApi", name: "Miro API", category: "productivity" },
95
+ { slug: "NotionToolkit", name: "Notion", category: "productivity" },
96
+ { slug: "OutlookCalendar", name: "Outlook Calendar", category: "productivity" },
97
+ { slug: "OutlookMail", name: "Outlook Mail", category: "productivity" },
98
+ { slug: "Pagerduty", name: "PagerDuty", category: "development" },
99
+ { slug: "PagerdutyApi", name: "PagerDuty API", category: "development" },
100
+ { slug: "PosthogApi", name: "PostHog API", category: "development" },
101
+ { slug: "Pylon", name: "Pylon", category: "customer-support" },
102
+ { slug: "PylonApi", name: "Pylon API", category: "customer-support" },
103
+ { slug: "Reddit", name: "Reddit", category: "social" },
104
+ { slug: "Salesforce", name: "Salesforce", category: "sales" },
105
+ { slug: "Sharepoint", name: "Microsoft SharePoint", category: "productivity" },
106
+ { slug: "Slack", name: "Slack", category: "social" },
107
+ { slug: "SlackApi", name: "Slack API", category: "social" },
108
+ { slug: "Spotify", name: "Spotify", category: "entertainment" },
109
+ { slug: "SquareupApi", name: "SquareUp API", category: "productivity" },
110
+ { slug: "Stripe", name: "Stripe", category: "payments" },
111
+ { slug: "StripeApi", name: "Stripe API", category: "payments" },
112
+ { slug: "TicktickApi", name: "TickTick API", category: "productivity" },
113
+ { slug: "TrelloApi", name: "Trello API", category: "productivity" },
114
+ { slug: "Twilio", name: "Twilio", category: "social" },
115
+ { slug: "VercelApi", name: "Vercel API", category: "development" },
116
+ { slug: "Walmart", name: "Walmart", category: "search" },
117
+ { slug: "WeaviateApi", name: "Weaviate API", category: "development" },
118
+ { slug: "X", name: "X", category: "social" },
119
+ { slug: "XeroApi", name: "Xero API", category: "productivity" },
120
+ { slug: "Youtube", name: "Youtube", category: "search" },
121
+ { slug: "Zendesk", name: "Zendesk", category: "customer-support" },
122
+ { slug: "ZohoBooksApi", name: "Zoho Books API", category: "payments" },
123
+ { slug: "Zoom", name: "Zoom", category: "social" }
124
+ ];
125
+ var ArcadeToolProvider = class {
126
+ constructor(config) {
127
+ this.info = {
128
+ id: "arcade",
129
+ name: "Arcade AI",
130
+ description: "Access 7,000+ tools from 130+ app integrations via Arcade AI"
131
+ };
132
+ this.client = null;
133
+ this.config = config;
134
+ this.toolkitCache = /* @__PURE__ */ new Map();
135
+ for (const tk of KNOWN_TOOLKITS) {
136
+ this.toolkitCache.set(tk.slug, {
137
+ slug: tk.slug,
138
+ name: tk.name,
139
+ description: tk.description ?? `Arcade AI ${tk.name} tools`,
140
+ icon: tk.category
141
+ });
142
+ }
143
+ }
144
+ /**
145
+ * Get or create an Arcade client.
146
+ */
147
+ getClient() {
148
+ if (!this.client) {
149
+ this.client = new import_arcadejs.Arcade({
150
+ apiKey: this.config.apiKey,
151
+ ...this.config.baseURL ? { baseURL: this.config.baseURL } : {}
152
+ });
153
+ }
154
+ return this.client;
155
+ }
156
+ /**
157
+ * Absorb toolkit metadata from a tool listing into the cache.
158
+ * Returns true if any new toolkit was discovered.
159
+ */
160
+ absorbToolkits(items) {
161
+ let discovered = false;
162
+ for (const tool of items) {
163
+ const tk = tool.toolkit;
164
+ if (tk?.name && !this.toolkitCache.has(tk.name)) {
165
+ this.toolkitCache.set(tk.name, {
166
+ slug: tk.name,
167
+ name: tk.name,
168
+ description: tk.description ?? `Arcade AI ${tk.name} tools`
169
+ });
170
+ discovered = true;
171
+ }
172
+ }
173
+ return discovered;
174
+ }
175
+ /**
176
+ * List toolkits.
177
+ *
178
+ * Returns the pre-seeded catalog merged with any toolkits discovered at
179
+ * runtime via `listTools()` or `resolveTools()` calls.
180
+ */
181
+ async listToolkits() {
182
+ const data = [...this.toolkitCache.values()].sort((a, b) => a.name.localeCompare(b.name));
183
+ return { data };
184
+ }
185
+ /**
186
+ * List available tools with optional toolkit and pagination filters.
187
+ * Uses `tools.list({ toolkit, limit, offset })`.
188
+ */
189
+ async listTools(options) {
190
+ const client = this.getClient();
191
+ const limit = options?.perPage ?? 50;
192
+ const page = options?.page ?? 1;
193
+ const offset = (page - 1) * limit;
194
+ const query = { limit, offset };
195
+ if (options?.toolkit) query.toolkit = options.toolkit;
196
+ const result = await client.tools.list(query);
197
+ const items = result.items ?? [];
198
+ this.absorbToolkits(items);
199
+ let filtered = items;
200
+ if (options?.search) {
201
+ const searchLower = options.search.toLowerCase();
202
+ filtered = items.filter(
203
+ (t) => t.name?.toLowerCase().includes(searchLower) || t.description?.toLowerCase().includes(searchLower) || t.qualified_name?.toLowerCase().includes(searchLower)
204
+ );
205
+ }
206
+ const data = filtered.map((tool) => ({
207
+ slug: tool.qualified_name ?? `${tool.toolkit?.name}.${tool.name}`,
208
+ name: tool.name,
209
+ description: tool.description,
210
+ toolkit: tool.toolkit?.name
211
+ }));
212
+ return {
213
+ data,
214
+ pagination: {
215
+ page,
216
+ perPage: limit,
217
+ total: result.total_count,
218
+ hasMore: offset + items.length < (result.total_count ?? 0)
219
+ }
220
+ };
221
+ }
222
+ /**
223
+ * Get the JSON schema for a specific tool by its qualified name (e.g., `Github.GetRepository`).
224
+ */
225
+ async getToolSchema(toolSlug) {
226
+ try {
227
+ const client = this.getClient();
228
+ const tool = await client.tools.get(toolSlug);
229
+ if (!tool) return null;
230
+ const properties = {};
231
+ const required = [];
232
+ for (const param of tool.input?.parameters ?? []) {
233
+ properties[param.name] = {
234
+ ...param.value_schema ?? {},
235
+ description: param.description
236
+ };
237
+ if (param.required) required.push(param.name);
238
+ }
239
+ return {
240
+ type: "object",
241
+ properties,
242
+ ...required.length > 0 ? { required } : {}
243
+ };
244
+ } catch {
245
+ return null;
246
+ }
247
+ }
248
+ /**
249
+ * Resolve executable tools in Mastra's ToolAction format.
250
+ *
251
+ * Uses `toZodToolSet` from `@arcadeai/arcadejs/lib` to create ZodTool objects
252
+ * with Zod schemas and execute functions, then wraps them as ToolAction objects.
253
+ */
254
+ async resolveTools(toolSlugs, toolConfigs, options) {
255
+ if (toolSlugs.length === 0) return {};
256
+ const client = this.getClient();
257
+ const userId = options?.userId ?? "default";
258
+ const toolDefs = await Promise.all(toolSlugs.map((slug) => client.tools.get(slug).catch(() => null)));
259
+ const validDefs = toolDefs.filter((d) => d !== null);
260
+ if (validDefs.length === 0) return {};
261
+ this.absorbToolkits(validDefs);
262
+ const zodToolSet = (0, import_lib.toZodToolSet)({
263
+ tools: validDefs,
264
+ client,
265
+ userId,
266
+ executeFactory: import_lib.executeOrAuthorizeZodTool
267
+ });
268
+ const result = {};
269
+ const normalizedToQualified = /* @__PURE__ */ new Map();
270
+ for (const d of validDefs) {
271
+ const qn = d.qualified_name ?? `${d.toolkit?.name}.${d.name}`;
272
+ normalizedToQualified.set(qn.replace(/\./g, "_"), qn);
273
+ }
274
+ for (const [key, zodTool] of Object.entries(zodToolSet)) {
275
+ const qualifiedName = normalizedToQualified.get(key) ?? key;
276
+ const descOverride = toolConfigs?.[qualifiedName]?.description ?? toolConfigs?.[key]?.description;
277
+ result[qualifiedName] = {
278
+ id: qualifiedName,
279
+ description: descOverride ?? zodTool.description ?? "",
280
+ inputSchema: zodTool.parameters,
281
+ outputSchema: zodTool.output,
282
+ execute: async (input) => {
283
+ return zodTool.execute(input);
284
+ }
285
+ };
286
+ }
287
+ return result;
288
+ }
289
+ };
290
+ // Annotate the CommonJS export names for ESM import in node:
291
+ 0 && (module.exports = {
292
+ ArcadeToolProvider
293
+ });
@@ -0,0 +1,66 @@
1
+ import { ToolProvider, ToolProviderInfo, ToolProviderListResult, ToolProviderToolkit, ListToolProviderToolsOptions, ToolProviderToolInfo, ResolveToolProviderToolsOptions } from '@mastra/core/tool-provider';
2
+ import { ToolAction } from '@mastra/core/tools';
3
+ import { StorageToolConfig } from '@mastra/core/storage';
4
+
5
+ interface ArcadeToolProviderConfig {
6
+ /** Arcade AI API key */
7
+ apiKey: string;
8
+ /** Base URL for the Arcade API (defaults to https://api.arcade.dev) */
9
+ baseURL?: string;
10
+ }
11
+ /**
12
+ * Arcade AI tool provider adapter.
13
+ *
14
+ * Uses `@arcadeai/arcadejs` SDK for discovery and runtime tool resolution.
15
+ * The SDK is a static import and tree-shaken if this provider class isn't used.
16
+ *
17
+ * Arcade tools use `Toolkit.ToolName` naming (e.g., `Github.GetRepository`).
18
+ * Each toolkit groups related tools and manages its own auth requirements.
19
+ *
20
+ * Discovery methods (`listToolkits`, `listTools`, `getToolSchema`) use the
21
+ * standard `tools.list()` / `tools.get()` SDK methods.
22
+ *
23
+ * Runtime method (`resolveTools`) uses `toZodToolSet` from `@arcadeai/arcadejs/lib`
24
+ * to get executable ZodTool objects, then converts them to Mastra's ToolAction format.
25
+ */
26
+ declare class ArcadeToolProvider implements ToolProvider {
27
+ readonly info: ToolProviderInfo;
28
+ private config;
29
+ private toolkitCache;
30
+ private client;
31
+ constructor(config: ArcadeToolProviderConfig);
32
+ /**
33
+ * Get or create an Arcade client.
34
+ */
35
+ private getClient;
36
+ /**
37
+ * Absorb toolkit metadata from a tool listing into the cache.
38
+ * Returns true if any new toolkit was discovered.
39
+ */
40
+ private absorbToolkits;
41
+ /**
42
+ * List toolkits.
43
+ *
44
+ * Returns the pre-seeded catalog merged with any toolkits discovered at
45
+ * runtime via `listTools()` or `resolveTools()` calls.
46
+ */
47
+ listToolkits(): Promise<ToolProviderListResult<ToolProviderToolkit>>;
48
+ /**
49
+ * List available tools with optional toolkit and pagination filters.
50
+ * Uses `tools.list({ toolkit, limit, offset })`.
51
+ */
52
+ listTools(options?: ListToolProviderToolsOptions): Promise<ToolProviderListResult<ToolProviderToolInfo>>;
53
+ /**
54
+ * Get the JSON schema for a specific tool by its qualified name (e.g., `Github.GetRepository`).
55
+ */
56
+ getToolSchema(toolSlug: string): Promise<Record<string, unknown> | null>;
57
+ /**
58
+ * Resolve executable tools in Mastra's ToolAction format.
59
+ *
60
+ * Uses `toZodToolSet` from `@arcadeai/arcadejs/lib` to create ZodTool objects
61
+ * with Zod schemas and execute functions, then wraps them as ToolAction objects.
62
+ */
63
+ resolveTools(toolSlugs: string[], toolConfigs?: Record<string, StorageToolConfig>, options?: ResolveToolProviderToolsOptions): Promise<Record<string, ToolAction<unknown, unknown>>>;
64
+ }
65
+
66
+ export { ArcadeToolProvider, type ArcadeToolProviderConfig };
@@ -0,0 +1,66 @@
1
+ import { ToolProvider, ToolProviderInfo, ToolProviderListResult, ToolProviderToolkit, ListToolProviderToolsOptions, ToolProviderToolInfo, ResolveToolProviderToolsOptions } from '@mastra/core/tool-provider';
2
+ import { ToolAction } from '@mastra/core/tools';
3
+ import { StorageToolConfig } from '@mastra/core/storage';
4
+
5
+ interface ArcadeToolProviderConfig {
6
+ /** Arcade AI API key */
7
+ apiKey: string;
8
+ /** Base URL for the Arcade API (defaults to https://api.arcade.dev) */
9
+ baseURL?: string;
10
+ }
11
+ /**
12
+ * Arcade AI tool provider adapter.
13
+ *
14
+ * Uses `@arcadeai/arcadejs` SDK for discovery and runtime tool resolution.
15
+ * The SDK is a static import and tree-shaken if this provider class isn't used.
16
+ *
17
+ * Arcade tools use `Toolkit.ToolName` naming (e.g., `Github.GetRepository`).
18
+ * Each toolkit groups related tools and manages its own auth requirements.
19
+ *
20
+ * Discovery methods (`listToolkits`, `listTools`, `getToolSchema`) use the
21
+ * standard `tools.list()` / `tools.get()` SDK methods.
22
+ *
23
+ * Runtime method (`resolveTools`) uses `toZodToolSet` from `@arcadeai/arcadejs/lib`
24
+ * to get executable ZodTool objects, then converts them to Mastra's ToolAction format.
25
+ */
26
+ declare class ArcadeToolProvider implements ToolProvider {
27
+ readonly info: ToolProviderInfo;
28
+ private config;
29
+ private toolkitCache;
30
+ private client;
31
+ constructor(config: ArcadeToolProviderConfig);
32
+ /**
33
+ * Get or create an Arcade client.
34
+ */
35
+ private getClient;
36
+ /**
37
+ * Absorb toolkit metadata from a tool listing into the cache.
38
+ * Returns true if any new toolkit was discovered.
39
+ */
40
+ private absorbToolkits;
41
+ /**
42
+ * List toolkits.
43
+ *
44
+ * Returns the pre-seeded catalog merged with any toolkits discovered at
45
+ * runtime via `listTools()` or `resolveTools()` calls.
46
+ */
47
+ listToolkits(): Promise<ToolProviderListResult<ToolProviderToolkit>>;
48
+ /**
49
+ * List available tools with optional toolkit and pagination filters.
50
+ * Uses `tools.list({ toolkit, limit, offset })`.
51
+ */
52
+ listTools(options?: ListToolProviderToolsOptions): Promise<ToolProviderListResult<ToolProviderToolInfo>>;
53
+ /**
54
+ * Get the JSON schema for a specific tool by its qualified name (e.g., `Github.GetRepository`).
55
+ */
56
+ getToolSchema(toolSlug: string): Promise<Record<string, unknown> | null>;
57
+ /**
58
+ * Resolve executable tools in Mastra's ToolAction format.
59
+ *
60
+ * Uses `toZodToolSet` from `@arcadeai/arcadejs/lib` to create ZodTool objects
61
+ * with Zod schemas and execute functions, then wraps them as ToolAction objects.
62
+ */
63
+ resolveTools(toolSlugs: string[], toolConfigs?: Record<string, StorageToolConfig>, options?: ResolveToolProviderToolsOptions): Promise<Record<string, ToolAction<unknown, unknown>>>;
64
+ }
65
+
66
+ export { ArcadeToolProvider, type ArcadeToolProviderConfig };