integrate-sdk 0.8.42 → 0.8.43-dev.0
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/dist/adapters/auto-routes.d.ts.map +1 -1
- package/dist/adapters/auto-routes.js +265 -139
- package/dist/adapters/base-handler.d.ts.map +1 -1
- package/dist/adapters/index.js +261 -137
- package/dist/adapters/nextjs-oauth-redirect.d.ts.map +1 -1
- package/dist/adapters/nextjs-oauth-redirect.js +47 -2
- package/dist/adapters/nextjs.d.ts.map +1 -1
- package/dist/adapters/nextjs.js +260 -137
- package/dist/adapters/node.js +260 -137
- package/dist/adapters/svelte-kit.js +260 -137
- package/dist/adapters/tanstack-start.js +260 -137
- package/dist/index.js +275 -147
- package/dist/oauth.js +265 -139
- package/dist/react.js +59 -14
- package/dist/server.js +264 -137
- package/dist/src/adapters/auto-routes.d.ts.map +1 -1
- package/dist/src/adapters/base-handler.d.ts.map +1 -1
- package/dist/src/adapters/nextjs-oauth-redirect.d.ts.map +1 -1
- package/dist/src/adapters/nextjs.d.ts.map +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +15 -0
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/integrations/airtable.d.ts.map +1 -1
- package/dist/src/integrations/calcom.d.ts.map +1 -1
- package/dist/src/integrations/cursor.d.ts.map +1 -1
- package/dist/src/integrations/figma.d.ts.map +1 -1
- package/dist/src/integrations/gcal.d.ts.map +1 -1
- package/dist/src/integrations/github.d.ts.map +1 -1
- package/dist/src/integrations/gmail.d.ts.map +1 -1
- package/dist/src/integrations/gworkspace.d.ts.map +1 -1
- package/dist/src/integrations/hubspot.d.ts.map +1 -1
- package/dist/src/integrations/intercom.d.ts.map +1 -1
- package/dist/src/integrations/linear.d.ts.map +1 -1
- package/dist/src/integrations/notion.d.ts.map +1 -1
- package/dist/src/integrations/onedrive.d.ts.map +1 -1
- package/dist/src/integrations/outlook.d.ts.map +1 -1
- package/dist/src/integrations/polar.d.ts.map +1 -1
- package/dist/src/integrations/ramp.d.ts.map +1 -1
- package/dist/src/integrations/slack.d.ts.map +1 -1
- package/dist/src/integrations/stripe.d.ts.map +1 -1
- package/dist/src/integrations/todoist.d.ts.map +1 -1
- package/dist/src/integrations/vercel.d.ts.map +1 -1
- package/dist/src/integrations/whatsapp.d.ts.map +1 -1
- package/dist/src/integrations/youtube.d.ts.map +1 -1
- package/dist/src/integrations/zendesk.d.ts.map +1 -1
- package/dist/src/oauth/email-fetcher.d.ts.map +1 -1
- package/dist/src/oauth/manager.d.ts.map +1 -1
- package/dist/src/oauth/window-manager.d.ts.map +1 -1
- package/dist/src/react/hooks.d.ts.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/transport/http-session.d.ts.map +1 -1
- package/dist/src/transport/http-stream.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts +37 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/adapters/base-handler.js +0 -561
- package/dist/ai/cloudflare.d.ts +0 -158
- package/dist/ai/cloudflare.d.ts.map +0 -1
- package/dist/ai/cloudflare.js +0 -4249
- package/dist/ai/langchain.d.ts +0 -139
- package/dist/ai/langchain.d.ts.map +0 -1
- package/dist/ai/langchain.js +0 -4237
- package/dist/ai/llamaindex.d.ts +0 -125
- package/dist/ai/llamaindex.d.ts.map +0 -1
- package/dist/ai/llamaindex.js +0 -4236
- package/dist/ai/mastra.d.ts +0 -138
- package/dist/ai/mastra.d.ts.map +0 -1
- package/dist/ai/mastra.js +0 -4240
- package/dist/src/ai/cloudflare.d.ts +0 -158
- package/dist/src/ai/cloudflare.d.ts.map +0 -1
- package/dist/src/ai/langchain.d.ts +0 -139
- package/dist/src/ai/langchain.d.ts.map +0 -1
- package/dist/src/ai/llamaindex.d.ts +0 -125
- package/dist/src/ai/llamaindex.d.ts.map +0 -1
- package/dist/src/ai/mastra.d.ts +0 -138
- package/dist/src/ai/mastra.d.ts.map +0 -1
- package/dist/src/integrations/vercel-ai.d.ts +0 -127
- package/dist/src/integrations/vercel-ai.d.ts.map +0 -1
- package/dist/src/plugins/generic.d.ts +0 -99
- package/dist/src/plugins/generic.d.ts.map +0 -1
- package/dist/src/plugins/github-client.d.ts +0 -320
- package/dist/src/plugins/github-client.d.ts.map +0 -1
- package/dist/src/plugins/github.d.ts +0 -89
- package/dist/src/plugins/github.d.ts.map +0 -1
- package/dist/src/plugins/gmail-client.d.ts +0 -106
- package/dist/src/plugins/gmail-client.d.ts.map +0 -1
- package/dist/src/plugins/gmail.d.ts +0 -87
- package/dist/src/plugins/gmail.d.ts.map +0 -1
- package/dist/src/plugins/server-client.d.ts +0 -18
- package/dist/src/plugins/server-client.d.ts.map +0 -1
- package/dist/src/plugins/types.d.ts +0 -70
- package/dist/src/plugins/types.d.ts.map +0 -1
package/dist/ai/cloudflare.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cloudflare Workers AI Integration
|
|
3
|
-
*
|
|
4
|
-
* Helper functions to convert MCP tools to Cloudflare Workers AI format
|
|
5
|
-
*/
|
|
6
|
-
import type { MCPClient } from "../client.js";
|
|
7
|
-
import type { MCPTool } from "../protocol/messages.js";
|
|
8
|
-
import { type AIToolsOptions } from "./utils.js";
|
|
9
|
-
/**
|
|
10
|
-
* Cloudflare AI tool definition
|
|
11
|
-
* Compatible with Cloudflare Workers AI
|
|
12
|
-
*/
|
|
13
|
-
export interface CloudflareTool {
|
|
14
|
-
type: 'function';
|
|
15
|
-
function: {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
parameters: {
|
|
19
|
-
type: 'object';
|
|
20
|
-
properties: Record<string, {
|
|
21
|
-
type: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
}>;
|
|
24
|
-
required: string[];
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Options for converting MCP tools to Cloudflare format
|
|
30
|
-
*/
|
|
31
|
-
export interface CloudflareToolsOptions extends AIToolsOptions {
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Convert a single MCP tool to Cloudflare Workers AI format
|
|
35
|
-
*
|
|
36
|
-
* @param mcpTool - The MCP tool definition
|
|
37
|
-
* @param client - The MCP client instance (used for executing the tool)
|
|
38
|
-
* @param options - Optional configuration including provider tokens
|
|
39
|
-
* @returns Cloudflare compatible tool definition
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const cloudflareTool = convertMCPToolToCloudflare(mcpTool, client);
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function convertMCPToolToCloudflare(mcpTool: MCPTool, _client: MCPClient<any>, _options?: CloudflareToolsOptions): CloudflareTool;
|
|
47
|
-
/**
|
|
48
|
-
* Convert all enabled MCP tools to Cloudflare Workers AI format
|
|
49
|
-
* Returns a dictionary keyed by tool name
|
|
50
|
-
*
|
|
51
|
-
* @param client - The MCP client instance (must be connected)
|
|
52
|
-
* @param options - Optional configuration including provider tokens
|
|
53
|
-
* @returns Dictionary of Cloudflare compatible tool definitions
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* // Client-side usage
|
|
58
|
-
* const tools = convertMCPToolsToCloudflare(mcpClient);
|
|
59
|
-
*
|
|
60
|
-
* // Server-side with provider tokens
|
|
61
|
-
* const tools = convertMCPToolsToCloudflare(serverClient, {
|
|
62
|
-
* providerTokens: { github: 'ghp_...', gmail: 'ya29...' }
|
|
63
|
-
* });
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export declare function convertMCPToolsToCloudflare(client: MCPClient<any>, options?: CloudflareToolsOptions): Record<string, CloudflareTool>;
|
|
67
|
-
/**
|
|
68
|
-
* Execute a tool call from Cloudflare Workers AI
|
|
69
|
-
*
|
|
70
|
-
* @param client - The MCP client instance
|
|
71
|
-
* @param toolCall - The tool call with name and arguments
|
|
72
|
-
* @param options - Optional configuration including provider tokens
|
|
73
|
-
* @returns Tool execution result as JSON string
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* const result = await executeCloudflareToolCall(client, {
|
|
78
|
-
* name: 'github_create_issue',
|
|
79
|
-
* arguments: { owner: 'user', repo: 'repo', title: 'Bug' }
|
|
80
|
-
* }, { providerTokens });
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
export declare function executeCloudflareToolCall(client: MCPClient<any>, toolCall: {
|
|
84
|
-
name: string;
|
|
85
|
-
arguments: Record<string, unknown> | string;
|
|
86
|
-
}, options?: CloudflareToolsOptions): Promise<string>;
|
|
87
|
-
/**
|
|
88
|
-
* Get tools in a format compatible with Cloudflare Workers AI
|
|
89
|
-
*
|
|
90
|
-
* Automatically connects the client if not already connected.
|
|
91
|
-
*
|
|
92
|
-
* @param client - The MCP client instance
|
|
93
|
-
* @param options - Optional configuration including provider tokens for server-side usage
|
|
94
|
-
* @returns Dictionary of tools ready to use with Cloudflare Workers AI
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* // Cloudflare Worker usage
|
|
99
|
-
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
100
|
-
* import { getCloudflareTools, executeCloudflareToolCall } from 'integrate-sdk/ai/cloudflare';
|
|
101
|
-
*
|
|
102
|
-
* export default {
|
|
103
|
-
* async fetch(request: Request, env: Env): Promise<Response> {
|
|
104
|
-
* const client = createMCPClient({
|
|
105
|
-
* integrations: [githubIntegration({ clientId: env.GITHUB_CLIENT_ID })],
|
|
106
|
-
* });
|
|
107
|
-
*
|
|
108
|
-
* const tools = await getCloudflareTools(client);
|
|
109
|
-
* const ai = new Ai(env.AI);
|
|
110
|
-
*
|
|
111
|
-
* const response = await ai.run('@cf/meta/llama-3-8b-instruct', {
|
|
112
|
-
* messages: [{ role: 'user', content: 'Create a GitHub issue' }],
|
|
113
|
-
* tools: Object.values(tools)
|
|
114
|
-
* });
|
|
115
|
-
*
|
|
116
|
-
* return Response.json(response);
|
|
117
|
-
* }
|
|
118
|
-
* };
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
* @example
|
|
122
|
-
* ```typescript
|
|
123
|
-
* // Server-side usage with tokens from client
|
|
124
|
-
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
125
|
-
* import { getCloudflareTools, executeCloudflareToolCall } from 'integrate-sdk/ai/cloudflare';
|
|
126
|
-
*
|
|
127
|
-
* const { client: serverClient } = createMCPServer({
|
|
128
|
-
* integrations: [githubIntegration({
|
|
129
|
-
* clientId: '...',
|
|
130
|
-
* clientSecret: '...'
|
|
131
|
-
* })],
|
|
132
|
-
* });
|
|
133
|
-
*
|
|
134
|
-
* // In your API route
|
|
135
|
-
* export async function POST(req: Request) {
|
|
136
|
-
* const providerTokens = JSON.parse(req.headers.get('x-integrate-tokens') || '{}');
|
|
137
|
-
* const tools = await getCloudflareTools(serverClient, { providerTokens });
|
|
138
|
-
*
|
|
139
|
-
* // Use with Cloudflare AI
|
|
140
|
-
* const ai = new Ai(env.AI);
|
|
141
|
-
* const response = await ai.run('@cf/meta/llama-3-8b-instruct', {
|
|
142
|
-
* messages: [{ role: 'user', content: 'Create a GitHub issue' }],
|
|
143
|
-
* tools: Object.values(tools)
|
|
144
|
-
* });
|
|
145
|
-
*
|
|
146
|
-
* // Handle tool calls
|
|
147
|
-
* if (response.tool_calls) {
|
|
148
|
-
* for (const toolCall of response.tool_calls) {
|
|
149
|
-
* await executeCloudflareToolCall(serverClient, toolCall, { providerTokens });
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
152
|
-
*
|
|
153
|
-
* return Response.json(response);
|
|
154
|
-
* }
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
export declare function getCloudflareTools(client: MCPClient<any>, options?: CloudflareToolsOptions): Promise<Record<string, CloudflareTool>>;
|
|
158
|
-
//# sourceMappingURL=cloudflare.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../../src/ai/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAkE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ,CAAC;YACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;gBACzB,IAAI,EAAE,MAAM,CAAC;gBACb,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC,CAAC;YACH,QAAQ,EAAE,MAAM,EAAE,CAAC;SACpB,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;CAAI;AAElE;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,EACvB,QAAQ,CAAC,EAAE,sBAAsB,GAChC,cAAc,CAahB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAShC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE;IACR,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;CAC7C,EACD,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAezC"}
|