integrate-sdk 0.7.22 → 0.7.24
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/ai/anthropic.d.ts +182 -0
- package/dist/ai/anthropic.d.ts.map +1 -0
- package/dist/ai/anthropic.js +4265 -0
- package/dist/ai/cloudflare.d.ts +158 -0
- package/dist/ai/cloudflare.d.ts.map +1 -0
- package/dist/ai/cloudflare.js +4249 -0
- package/dist/ai/google.d.ts +159 -0
- package/dist/ai/google.d.ts.map +1 -0
- package/dist/ai/google.js +4242 -0
- package/dist/ai/index.d.ts +79 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +4580 -0
- package/dist/ai/langchain.d.ts +139 -0
- package/dist/ai/langchain.d.ts.map +1 -0
- package/dist/ai/langchain.js +4237 -0
- package/dist/ai/llamaindex.d.ts +125 -0
- package/dist/ai/llamaindex.d.ts.map +1 -0
- package/dist/ai/llamaindex.js +4236 -0
- package/dist/ai/mastra.d.ts +138 -0
- package/dist/ai/mastra.d.ts.map +1 -0
- package/dist/ai/mastra.js +4240 -0
- package/dist/ai/openai-agents.d.ts +99 -0
- package/dist/ai/openai-agents.d.ts.map +1 -0
- package/dist/ai/openai-agents.js +4235 -0
- package/dist/ai/openai.d.ts +130 -0
- package/dist/ai/openai.d.ts.map +1 -0
- package/dist/ai/openai.js +4245 -0
- package/dist/ai/utils.d.ts +75 -0
- package/dist/ai/utils.d.ts.map +1 -0
- package/dist/ai/utils.js +4212 -0
- package/dist/ai/vercel-ai.d.ts +141 -0
- package/dist/ai/vercel-ai.d.ts.map +1 -0
- package/dist/ai/vercel-ai.js +4238 -0
- package/package.json +12 -6
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for AI provider integrations
|
|
3
|
+
*
|
|
4
|
+
* Common functions used across different AI provider integrations
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import type { MCPClient } from "../client.js";
|
|
8
|
+
/**
|
|
9
|
+
* Options for AI provider tool conversions
|
|
10
|
+
*/
|
|
11
|
+
export interface AIToolsOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Provider tokens for server-side usage
|
|
14
|
+
* Maps provider names (e.g., 'github', 'gmail') to their access tokens
|
|
15
|
+
*
|
|
16
|
+
* **Auto-extraction**: If not provided, tokens will be automatically extracted
|
|
17
|
+
* from the request headers (`x-integrate-tokens`) or environment variables.
|
|
18
|
+
* This works in supported frameworks like Next.js and Nuxt.
|
|
19
|
+
*
|
|
20
|
+
* **Manual override**: Pass this option to explicitly provide tokens when
|
|
21
|
+
* auto-extraction is not available or you need custom control.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Auto-extraction (tokens extracted automatically from request)
|
|
26
|
+
* const tools = await getVercelAITools(serverClient);
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Manual override
|
|
32
|
+
* const tools = await getVercelAITools(serverClient, {
|
|
33
|
+
* providerTokens: {
|
|
34
|
+
* github: 'ghp_...',
|
|
35
|
+
* gmail: 'ya29...'
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
providerTokens?: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the provider for a tool by checking which integration includes it
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare function getProviderForTool(client: MCPClient<any>, toolName: string): string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Convert a JSON Schema property to a Zod schema
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function jsonSchemaPropertyToZod(propSchema: any): z.ZodType<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Convert JSON Schema to Zod schema for AI SDKs that use Zod
|
|
54
|
+
* Handles edge cases like missing schemas, type: "None", or invalid types
|
|
55
|
+
* Always returns a valid Zod object schema
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare function jsonSchemaToZod(schema: any): z.ZodObject<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Execute a tool with provider token injection
|
|
61
|
+
* For server-side usage, temporarily injects provider tokens into the OAuthManager
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare function executeToolWithToken(client: MCPClient<any>, toolName: string, args: Record<string, unknown>, options?: AIToolsOptions): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Auto-connect client if needed
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
export declare function ensureClientConnected(client: MCPClient<any>): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Re-export token extraction utilities
|
|
72
|
+
* These help extract provider tokens from request headers automatically
|
|
73
|
+
*/
|
|
74
|
+
export { getProviderTokens, tryGetProviderTokens } from "../utils/request-tokens.js";
|
|
75
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/ai/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG/F;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAqFvE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAoD7D;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,GAAG,CAAC,CAoCd;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjF;AAED;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
|