integrate-sdk 0.8.39 → 0.8.42-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.
Files changed (57) hide show
  1. package/dist/adapters/auto-routes.js +1471 -60
  2. package/dist/adapters/index.js +1471 -60
  3. package/dist/adapters/nextjs.js +1471 -60
  4. package/dist/adapters/node.js +1471 -60
  5. package/dist/adapters/svelte-kit.js +1471 -60
  6. package/dist/adapters/tanstack-start.js +1471 -60
  7. package/dist/ai/anthropic.d.ts.map +1 -1
  8. package/dist/ai/anthropic.js +5 -21
  9. package/dist/ai/google.d.ts.map +1 -1
  10. package/dist/ai/google.js +57 -18
  11. package/dist/ai/index.js +67 -60
  12. package/dist/ai/openai.d.ts.map +1 -1
  13. package/dist/ai/openai.js +5 -21
  14. package/dist/index.js +1471 -60
  15. package/dist/oauth.js +1471 -60
  16. package/dist/server.js +1471 -60
  17. package/dist/src/ai/anthropic.d.ts.map +1 -1
  18. package/dist/src/ai/google.d.ts.map +1 -1
  19. package/dist/src/ai/openai.d.ts.map +1 -1
  20. package/package.json +6 -5
  21. package/dist/adapters/base-handler.js +0 -561
  22. package/dist/ai/cloudflare.d.ts +0 -158
  23. package/dist/ai/cloudflare.d.ts.map +0 -1
  24. package/dist/ai/cloudflare.js +0 -4249
  25. package/dist/ai/langchain.d.ts +0 -139
  26. package/dist/ai/langchain.d.ts.map +0 -1
  27. package/dist/ai/langchain.js +0 -4237
  28. package/dist/ai/llamaindex.d.ts +0 -125
  29. package/dist/ai/llamaindex.d.ts.map +0 -1
  30. package/dist/ai/llamaindex.js +0 -4236
  31. package/dist/ai/mastra.d.ts +0 -138
  32. package/dist/ai/mastra.d.ts.map +0 -1
  33. package/dist/ai/mastra.js +0 -4240
  34. package/dist/src/ai/cloudflare.d.ts +0 -158
  35. package/dist/src/ai/cloudflare.d.ts.map +0 -1
  36. package/dist/src/ai/langchain.d.ts +0 -139
  37. package/dist/src/ai/langchain.d.ts.map +0 -1
  38. package/dist/src/ai/llamaindex.d.ts +0 -125
  39. package/dist/src/ai/llamaindex.d.ts.map +0 -1
  40. package/dist/src/ai/mastra.d.ts +0 -138
  41. package/dist/src/ai/mastra.d.ts.map +0 -1
  42. package/dist/src/integrations/vercel-ai.d.ts +0 -127
  43. package/dist/src/integrations/vercel-ai.d.ts.map +0 -1
  44. package/dist/src/plugins/generic.d.ts +0 -99
  45. package/dist/src/plugins/generic.d.ts.map +0 -1
  46. package/dist/src/plugins/github-client.d.ts +0 -320
  47. package/dist/src/plugins/github-client.d.ts.map +0 -1
  48. package/dist/src/plugins/github.d.ts +0 -89
  49. package/dist/src/plugins/github.d.ts.map +0 -1
  50. package/dist/src/plugins/gmail-client.d.ts +0 -106
  51. package/dist/src/plugins/gmail-client.d.ts.map +0 -1
  52. package/dist/src/plugins/gmail.d.ts +0 -87
  53. package/dist/src/plugins/gmail.d.ts.map +0 -1
  54. package/dist/src/plugins/server-client.d.ts +0 -18
  55. package/dist/src/plugins/server-client.d.ts.map +0 -1
  56. package/dist/src/plugins/types.d.ts +0 -70
  57. package/dist/src/plugins/types.d.ts.map +0 -1
@@ -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"}