@yourgpt/copilot-sdk 2.0.1 → 2.0.2-beta.2

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 (215) hide show
  1. package/README.md +42 -0
  2. package/dist/{ThreadManager-JT0sqSSD.d.ts → ThreadManager-Dkp_eLty.d.ts} +1 -1
  3. package/dist/{ThreadManager-CUq5Ocu2.d.cts → ThreadManager-LfFRhr4e.d.cts} +1 -1
  4. package/dist/anthropic-6F5GRE3B.js +4 -0
  5. package/dist/anthropic-6F5GRE3B.js.map +1 -0
  6. package/dist/anthropic-DGalr_Fw.d.cts +17 -0
  7. package/dist/anthropic-DkCEDYOt.d.ts +17 -0
  8. package/dist/anthropic-NMTRABEH.cjs +21 -0
  9. package/dist/anthropic-NMTRABEH.cjs.map +1 -0
  10. package/dist/brave-DdnWb7Gb.d.cts +17 -0
  11. package/dist/brave-DsI9n7Wr.d.ts +17 -0
  12. package/dist/brave-OYKCOZEM.cjs +21 -0
  13. package/dist/brave-OYKCOZEM.cjs.map +1 -0
  14. package/dist/brave-XSASGGH2.js +4 -0
  15. package/dist/brave-XSASGGH2.js.map +1 -0
  16. package/dist/chunk-2FAWEBZS.cjs +88 -0
  17. package/dist/chunk-2FAWEBZS.cjs.map +1 -0
  18. package/dist/chunk-53UGJNHN.js +92 -0
  19. package/dist/chunk-53UGJNHN.js.map +1 -0
  20. package/dist/chunk-6T5XXJEP.cjs +80 -0
  21. package/dist/chunk-6T5XXJEP.cjs.map +1 -0
  22. package/dist/chunk-7K7HZMP4.cjs +1170 -0
  23. package/dist/chunk-7K7HZMP4.cjs.map +1 -0
  24. package/dist/chunk-7W7QLZNC.js +72 -0
  25. package/dist/chunk-7W7QLZNC.js.map +1 -0
  26. package/dist/{chunk-JM7PB2LP.js → chunk-7XFFRV7D.js} +10 -66
  27. package/dist/chunk-7XFFRV7D.js.map +1 -0
  28. package/dist/chunk-ASV6JLYG.cjs +99 -0
  29. package/dist/chunk-ASV6JLYG.cjs.map +1 -0
  30. package/dist/chunk-BH7MNDWW.js +1152 -0
  31. package/dist/chunk-BH7MNDWW.js.map +1 -0
  32. package/dist/chunk-BKO7DSPU.js +67 -0
  33. package/dist/chunk-BKO7DSPU.js.map +1 -0
  34. package/dist/chunk-CBAHCI4R.cjs +76 -0
  35. package/dist/chunk-CBAHCI4R.cjs.map +1 -0
  36. package/dist/chunk-CEKAYA2Q.cjs +74 -0
  37. package/dist/chunk-CEKAYA2Q.cjs.map +1 -0
  38. package/dist/chunk-CEOMTQTP.js +85 -0
  39. package/dist/chunk-CEOMTQTP.js.map +1 -0
  40. package/dist/chunk-DABZYCVX.js +84 -0
  41. package/dist/chunk-DABZYCVX.js.map +1 -0
  42. package/dist/chunk-DGUM43GV.js +10 -0
  43. package/dist/chunk-DGUM43GV.js.map +1 -0
  44. package/dist/chunk-G4SF2PNQ.js +33 -0
  45. package/dist/chunk-G4SF2PNQ.js.map +1 -0
  46. package/dist/chunk-GANCV72Z.cjs +110 -0
  47. package/dist/chunk-GANCV72Z.cjs.map +1 -0
  48. package/dist/{chunk-BLSI67J6.cjs → chunk-H5XMKBBA.cjs} +425 -30
  49. package/dist/chunk-H5XMKBBA.cjs.map +1 -0
  50. package/dist/{chunk-CJ7UWN2Y.js → chunk-IXFV6AW6.js} +397 -7
  51. package/dist/chunk-IXFV6AW6.js.map +1 -0
  52. package/dist/chunk-JEQ2X3Z6.cjs +12 -0
  53. package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
  54. package/dist/chunk-JO4BHPAD.cjs +40 -0
  55. package/dist/chunk-JO4BHPAD.cjs.map +1 -0
  56. package/dist/chunk-MEBXW75C.cjs +89 -0
  57. package/dist/chunk-MEBXW75C.cjs.map +1 -0
  58. package/dist/chunk-MNDGIW47.js +76 -0
  59. package/dist/chunk-MNDGIW47.js.map +1 -0
  60. package/dist/chunk-PPFHA6IL.js +83 -0
  61. package/dist/chunk-PPFHA6IL.js.map +1 -0
  62. package/dist/chunk-RQ74USYU.js +128 -0
  63. package/dist/chunk-RQ74USYU.js.map +1 -0
  64. package/dist/chunk-TXLIY7GF.cjs +132 -0
  65. package/dist/chunk-TXLIY7GF.cjs.map +1 -0
  66. package/dist/chunk-UIWFYMAO.cjs +82 -0
  67. package/dist/chunk-UIWFYMAO.cjs.map +1 -0
  68. package/dist/{chunk-4PRWNAXQ.cjs → chunk-UOWLKFXK.cjs} +27 -89
  69. package/dist/chunk-UOWLKFXK.cjs.map +1 -0
  70. package/dist/chunk-VD74IPKB.js +106 -0
  71. package/dist/chunk-VD74IPKB.js.map +1 -0
  72. package/dist/chunk-W73FBYIH.cjs +87 -0
  73. package/dist/chunk-W73FBYIH.cjs.map +1 -0
  74. package/dist/chunk-XGITAEXU.js +93 -0
  75. package/dist/chunk-XGITAEXU.js.map +1 -0
  76. package/dist/chunk-XWOHNY3F.cjs +96 -0
  77. package/dist/chunk-XWOHNY3F.cjs.map +1 -0
  78. package/dist/chunk-ZPYQDMUX.js +79 -0
  79. package/dist/chunk-ZPYQDMUX.js.map +1 -0
  80. package/dist/core/index.cjs +156 -84
  81. package/dist/core/index.d.cts +16 -4
  82. package/dist/core/index.d.ts +16 -4
  83. package/dist/core/index.js +13 -1
  84. package/dist/exa-72KFY5A7.cjs +21 -0
  85. package/dist/exa-72KFY5A7.cjs.map +1 -0
  86. package/dist/exa-Dp9U-WTc.d.ts +17 -0
  87. package/dist/exa-NNVPBC2M.js +4 -0
  88. package/dist/exa-NNVPBC2M.js.map +1 -0
  89. package/dist/exa-jJSPhyUW.d.cts +17 -0
  90. package/dist/google-CHU2yycE.d.cts +17 -0
  91. package/dist/google-CTEK6SV2.js +4 -0
  92. package/dist/google-CTEK6SV2.js.map +1 -0
  93. package/dist/google-Da8IQxaI.d.ts +17 -0
  94. package/dist/google-IIUXFFVF.cjs +21 -0
  95. package/dist/google-IIUXFFVF.cjs.map +1 -0
  96. package/dist/index-2VtgKM8S.d.cts +206 -0
  97. package/dist/index-pWEH7pUE.d.ts +206 -0
  98. package/dist/mcp/index.cjs +670 -0
  99. package/dist/mcp/index.cjs.map +1 -0
  100. package/dist/mcp/index.d.cts +779 -0
  101. package/dist/mcp/index.d.ts +779 -0
  102. package/dist/mcp/index.js +574 -0
  103. package/dist/mcp/index.js.map +1 -0
  104. package/dist/openai-6KTCQ7PZ.cjs +21 -0
  105. package/dist/openai-6KTCQ7PZ.cjs.map +1 -0
  106. package/dist/openai-7W2PCNW5.js +4 -0
  107. package/dist/openai-7W2PCNW5.js.map +1 -0
  108. package/dist/openai-Cam8hF4f.d.ts +17 -0
  109. package/dist/openai-HVSCuXgO.d.cts +17 -0
  110. package/dist/react/index.cjs +75 -42
  111. package/dist/react/index.d.cts +270 -45
  112. package/dist/react/index.d.ts +270 -45
  113. package/dist/react/index.js +15 -2
  114. package/dist/searxng-AXLVGY7Z.js +4 -0
  115. package/dist/searxng-AXLVGY7Z.js.map +1 -0
  116. package/dist/searxng-EJKNY236.cjs +21 -0
  117. package/dist/searxng-EJKNY236.cjs.map +1 -0
  118. package/dist/searxng-K0qtY9vp.d.ts +17 -0
  119. package/dist/searxng-QGOte_Gq.d.cts +17 -0
  120. package/dist/serper-3JYJHJX6.js +4 -0
  121. package/dist/serper-3JYJHJX6.js.map +1 -0
  122. package/dist/serper-63FT4AOL.cjs +21 -0
  123. package/dist/serper-63FT4AOL.cjs.map +1 -0
  124. package/dist/serper-7Czya3PW.d.ts +17 -0
  125. package/dist/serper-JzdaSnS9.d.cts +17 -0
  126. package/dist/styles.css +38 -0
  127. package/dist/tavily-AWFP4RM7.cjs +21 -0
  128. package/dist/tavily-AWFP4RM7.cjs.map +1 -0
  129. package/dist/tavily-C8cXXojE.d.cts +17 -0
  130. package/dist/tavily-CIWAAZPH.js +4 -0
  131. package/dist/tavily-CIWAAZPH.js.map +1 -0
  132. package/dist/tavily-DdSGVgkE.d.ts +17 -0
  133. package/dist/themes/catppuccin.css +2 -0
  134. package/dist/themes/claude.css +2 -0
  135. package/dist/themes/linear.css +2 -0
  136. package/dist/themes/modern-minimal.css +2 -0
  137. package/dist/themes/posthog.css +2 -0
  138. package/dist/themes/supabase.css +2 -0
  139. package/dist/themes/twitter.css +2 -0
  140. package/dist/themes/vercel.css +2 -0
  141. package/dist/tools/anthropic/index.cjs +61 -0
  142. package/dist/tools/anthropic/index.cjs.map +1 -0
  143. package/dist/tools/anthropic/index.d.cts +67 -0
  144. package/dist/tools/anthropic/index.d.ts +67 -0
  145. package/dist/tools/anthropic/index.js +56 -0
  146. package/dist/tools/anthropic/index.js.map +1 -0
  147. package/dist/tools/brave/index.cjs +85 -0
  148. package/dist/tools/brave/index.cjs.map +1 -0
  149. package/dist/tools/brave/index.d.cts +91 -0
  150. package/dist/tools/brave/index.d.ts +91 -0
  151. package/dist/tools/brave/index.js +80 -0
  152. package/dist/tools/brave/index.js.map +1 -0
  153. package/dist/tools/exa/index.cjs +90 -0
  154. package/dist/tools/exa/index.cjs.map +1 -0
  155. package/dist/tools/exa/index.d.cts +92 -0
  156. package/dist/tools/exa/index.d.ts +92 -0
  157. package/dist/tools/exa/index.js +85 -0
  158. package/dist/tools/exa/index.js.map +1 -0
  159. package/dist/tools/google/index.cjs +81 -0
  160. package/dist/tools/google/index.cjs.map +1 -0
  161. package/dist/tools/google/index.d.cts +81 -0
  162. package/dist/tools/google/index.d.ts +81 -0
  163. package/dist/tools/google/index.js +76 -0
  164. package/dist/tools/google/index.js.map +1 -0
  165. package/dist/tools/openai/index.cjs +83 -0
  166. package/dist/tools/openai/index.cjs.map +1 -0
  167. package/dist/tools/openai/index.d.cts +84 -0
  168. package/dist/tools/openai/index.d.ts +84 -0
  169. package/dist/tools/openai/index.js +78 -0
  170. package/dist/tools/openai/index.js.map +1 -0
  171. package/dist/tools/searxng/index.cjs +85 -0
  172. package/dist/tools/searxng/index.cjs.map +1 -0
  173. package/dist/tools/searxng/index.d.cts +91 -0
  174. package/dist/tools/searxng/index.d.ts +91 -0
  175. package/dist/tools/searxng/index.js +80 -0
  176. package/dist/tools/searxng/index.js.map +1 -0
  177. package/dist/tools/serper/index.cjs +85 -0
  178. package/dist/tools/serper/index.cjs.map +1 -0
  179. package/dist/tools/serper/index.d.cts +91 -0
  180. package/dist/tools/serper/index.d.ts +91 -0
  181. package/dist/tools/serper/index.js +80 -0
  182. package/dist/tools/serper/index.js.map +1 -0
  183. package/dist/tools/tavily/index.cjs +91 -0
  184. package/dist/tools/tavily/index.cjs.map +1 -0
  185. package/dist/tools/tavily/index.d.cts +95 -0
  186. package/dist/tools/tavily/index.d.ts +95 -0
  187. package/dist/tools/tavily/index.js +86 -0
  188. package/dist/tools/tavily/index.js.map +1 -0
  189. package/dist/tools/web-search/index.cjs +31 -0
  190. package/dist/tools/web-search/index.cjs.map +1 -0
  191. package/dist/tools/web-search/index.d.cts +3 -0
  192. package/dist/tools/web-search/index.d.ts +3 -0
  193. package/dist/tools/web-search/index.js +14 -0
  194. package/dist/tools/web-search/index.js.map +1 -0
  195. package/dist/{types-BtAaOV07.d.cts → tools-DDWrco4h.d.cts} +43 -367
  196. package/dist/{types-BtAaOV07.d.ts → tools-DDWrco4h.d.ts} +43 -367
  197. package/dist/types-B20VCJXL.d.cts +347 -0
  198. package/dist/types-B20VCJXL.d.ts +347 -0
  199. package/dist/types-Cizh9K_f.d.ts +441 -0
  200. package/dist/types-DG2ya08y.d.cts +367 -0
  201. package/dist/types-DG2ya08y.d.ts +367 -0
  202. package/dist/types-DjSfYNKj.d.cts +441 -0
  203. package/dist/types-ZguuKEs_.d.cts +127 -0
  204. package/dist/types-ZguuKEs_.d.ts +127 -0
  205. package/dist/ui/index.cjs +1075 -148
  206. package/dist/ui/index.cjs.map +1 -1
  207. package/dist/ui/index.d.cts +410 -4
  208. package/dist/ui/index.d.ts +410 -4
  209. package/dist/ui/index.js +1007 -96
  210. package/dist/ui/index.js.map +1 -1
  211. package/package.json +52 -2
  212. package/dist/chunk-4PRWNAXQ.cjs.map +0 -1
  213. package/dist/chunk-BLSI67J6.cjs.map +0 -1
  214. package/dist/chunk-CJ7UWN2Y.js.map +0 -1
  215. package/dist/chunk-JM7PB2LP.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"google-CTEK6SV2.js"}
@@ -0,0 +1,17 @@
1
+ import { W as WebSearchProviderInterface } from './types-ZguuKEs_.js';
2
+
3
+ /**
4
+ * Google Web Search Provider (Grounding with Google Search)
5
+ *
6
+ * Uses Google's built-in grounding feature via the Gemini API.
7
+ * No third-party API key required - uses your Google/Gemini API key.
8
+ *
9
+ * @see https://ai.google.dev/gemini-api/docs/google-search
10
+ */
11
+
12
+ /**
13
+ * Google native search provider implementation
14
+ */
15
+ declare const googleProvider: WebSearchProviderInterface;
16
+
17
+ export { googleProvider as g };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var chunkXWOHNY3F_cjs = require('./chunk-XWOHNY3F.cjs');
4
+ require('./chunk-JEQ2X3Z6.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "googleProvider", {
9
+ enumerable: true,
10
+ get: function () { return chunkXWOHNY3F_cjs.googleProvider; }
11
+ });
12
+ Object.defineProperty(exports, "searchGoogle", {
13
+ enumerable: true,
14
+ get: function () { return chunkXWOHNY3F_cjs.searchGoogle; }
15
+ });
16
+ Object.defineProperty(exports, "validateGoogleConfig", {
17
+ enumerable: true,
18
+ get: function () { return chunkXWOHNY3F_cjs.validateGoogleConfig; }
19
+ });
20
+ //# sourceMappingURL=google-IIUXFFVF.cjs.map
21
+ //# sourceMappingURL=google-IIUXFFVF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"google-IIUXFFVF.cjs"}
@@ -0,0 +1,206 @@
1
+ import { b as WebSearchConfig, a as WebSearchProvider, W as WebSearchProviderInterface, c as WebSearchParams, f as WebSearchResponse } from './types-ZguuKEs_.cjs';
2
+ import { T as ToolDefinition } from './tools-DDWrco4h.cjs';
3
+
4
+ /**
5
+ * Web Search Module
6
+ *
7
+ * Multi-provider web search with unified API.
8
+ * Supports tree-shaking - only the provider you use gets bundled.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Option 1: Lazy loading (provider loaded on first use)
13
+ * import { executeWebSearch } from './webSearch';
14
+ * const results = await executeWebSearch(
15
+ * { query: 'latest AI news' },
16
+ * { provider: 'tavily', apiKey: 'your-api-key' }
17
+ * );
18
+ *
19
+ * // Option 2: Direct import (best for tree-shaking)
20
+ * import { tavilyProvider, executeWebSearch } from './webSearch';
21
+ * const results = await executeWebSearch(
22
+ * { query: 'latest AI news' },
23
+ * { provider: tavilyProvider, apiKey: 'your-api-key' }
24
+ * );
25
+ * ```
26
+ */
27
+
28
+ /**
29
+ * Get a provider by name (lazy loading)
30
+ *
31
+ * @param name - Provider name string
32
+ * @returns Provider interface (loaded dynamically)
33
+ */
34
+ declare function getProvider(name: WebSearchProvider): Promise<WebSearchProviderInterface>;
35
+ /**
36
+ * Get all available provider names
37
+ */
38
+ declare function getAvailableProviders(): WebSearchProvider[];
39
+ /**
40
+ * Extended config that allows passing provider directly for tree-shaking
41
+ */
42
+ interface WebSearchConfigExtended extends Omit<WebSearchConfig, "provider"> {
43
+ /**
44
+ * Provider can be either:
45
+ * - A string name (lazy loaded): "tavily", "openai", "anthropic", "google", etc.
46
+ * - A provider instance (best for tree-shaking): import { tavilyProvider } from '...'
47
+ */
48
+ provider: WebSearchProvider | WebSearchProviderInterface;
49
+ }
50
+ /**
51
+ * Execute a web search using the configured provider
52
+ *
53
+ * @param params - Search parameters (query, maxResults, searchDepth)
54
+ * @param config - Provider configuration (provider, apiKey, options)
55
+ * @returns Search results with optional AI-generated answer
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Option 1: String provider name (lazy loaded)
60
+ * const results = await executeWebSearch(
61
+ * { query: 'What is the latest news about SpaceX?' },
62
+ * {
63
+ * provider: 'tavily',
64
+ * apiKey: process.env.TAVILY_API_KEY,
65
+ * }
66
+ * );
67
+ *
68
+ * // Option 2: Direct provider import (best for tree-shaking)
69
+ * import { tavilyProvider } from '@yourgpt/copilot-sdk/core';
70
+ * const results = await executeWebSearch(
71
+ * { query: 'What is the latest news about SpaceX?' },
72
+ * {
73
+ * provider: tavilyProvider,
74
+ * apiKey: process.env.TAVILY_API_KEY,
75
+ * }
76
+ * );
77
+ * ```
78
+ */
79
+ declare function executeWebSearch(params: WebSearchParams, config: WebSearchConfigExtended): Promise<WebSearchResponse>;
80
+ /**
81
+ * Format search results for display in AI context
82
+ *
83
+ * @param response - Web search response
84
+ * @param options - Formatting options
85
+ * @returns Formatted string for AI consumption
86
+ */
87
+ declare function formatSearchResultsForAI(response: WebSearchResponse, options?: {
88
+ includeUrls?: boolean;
89
+ includeScores?: boolean;
90
+ maxContentLength?: number;
91
+ }): string;
92
+ /**
93
+ * Create a minimal search result summary
94
+ *
95
+ * @param response - Web search response
96
+ * @returns Brief summary string
97
+ */
98
+ declare function summarizeSearchResults(response: WebSearchResponse): string;
99
+
100
+ /**
101
+ * Built-in Web Search Tool
102
+ *
103
+ * A pre-configured tool for searching the web with multiple provider support.
104
+ * Runs on the server to protect API keys.
105
+ *
106
+ * Supports tree-shaking - import providers directly for smaller bundles.
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * // Option 1: String provider (lazy loaded at runtime)
111
+ * import { createWebSearchTool } from '@yourgpt/copilot-sdk';
112
+ * const webSearch = createWebSearchTool({
113
+ * provider: 'tavily',
114
+ * apiKey: process.env.TAVILY_API_KEY,
115
+ * });
116
+ *
117
+ * // Option 2: Direct provider import (best for tree-shaking)
118
+ * import { createWebSearchTool, tavilyProvider } from '@yourgpt/copilot-sdk';
119
+ * const webSearch = createWebSearchTool({
120
+ * provider: tavilyProvider,
121
+ * apiKey: process.env.TAVILY_API_KEY,
122
+ * });
123
+ *
124
+ * // Add to your runtime
125
+ * const runtime = createRuntime({
126
+ * tools: [webSearch],
127
+ * });
128
+ * ```
129
+ */
130
+
131
+ /**
132
+ * Base web search tool definition
133
+ *
134
+ * This is the core tool definition. Use `createWebSearchTool()` to create
135
+ * a configured instance with your provider settings.
136
+ */
137
+ declare const webSearchTool: Omit<ToolDefinition<WebSearchParams>, "name">;
138
+ /**
139
+ * Create a configured web search tool
140
+ *
141
+ * Supports both string provider names (lazy loaded) and direct provider imports (tree-shakeable).
142
+ *
143
+ * @param config - Web search configuration including provider and API key
144
+ * @returns A configured tool definition ready to use
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // ===== BEST FOR TREE-SHAKING: Direct provider import =====
149
+ * import { createWebSearchTool, openaiProvider } from '@yourgpt/copilot-sdk/core';
150
+ *
151
+ * const webSearch = createWebSearchTool({
152
+ * provider: openaiProvider, // Only this provider in bundle
153
+ * apiKey: process.env.OPENAI_API_KEY,
154
+ * });
155
+ *
156
+ * // ===== STRING PROVIDERS (Lazy loaded at runtime) =====
157
+ *
158
+ * // OpenAI (uses your OpenAI API key)
159
+ * const webSearch = createWebSearchTool({
160
+ * provider: 'openai',
161
+ * apiKey: process.env.OPENAI_API_KEY,
162
+ * });
163
+ *
164
+ * // Google (uses your Google/Gemini API key)
165
+ * const webSearch = createWebSearchTool({
166
+ * provider: 'google',
167
+ * apiKey: process.env.GOOGLE_API_KEY,
168
+ * });
169
+ *
170
+ * // Tavily (AI-optimized search with answer generation)
171
+ * const webSearch = createWebSearchTool({
172
+ * provider: 'tavily',
173
+ * apiKey: process.env.TAVILY_API_KEY,
174
+ * includeAnswer: true,
175
+ * maxResults: 5,
176
+ * });
177
+ *
178
+ * // Serper (Google results)
179
+ * const webSearch = createWebSearchTool({
180
+ * provider: 'serper',
181
+ * apiKey: process.env.SERPER_API_KEY,
182
+ * });
183
+ *
184
+ * // Brave Search (privacy-focused)
185
+ * const webSearch = createWebSearchTool({
186
+ * provider: 'brave',
187
+ * apiKey: process.env.BRAVE_API_KEY,
188
+ * });
189
+ *
190
+ * // Self-hosted SearXNG (no API key needed)
191
+ * const webSearch = createWebSearchTool({
192
+ * provider: 'searxng',
193
+ * baseUrl: 'https://your-searxng-instance.com',
194
+ * });
195
+ *
196
+ * // Exa (AI-optimized semantic search)
197
+ * const webSearch = createWebSearchTool({
198
+ * provider: 'exa',
199
+ * apiKey: process.env.EXA_API_KEY,
200
+ * searchDepth: 'advanced',
201
+ * });
202
+ * ```
203
+ */
204
+ declare function createWebSearchTool(config: WebSearchConfigExtended): ToolDefinition<WebSearchParams>;
205
+
206
+ export { getAvailableProviders as a, createWebSearchTool as c, executeWebSearch as e, formatSearchResultsForAI as f, getProvider as g, summarizeSearchResults as s, webSearchTool as w };
@@ -0,0 +1,206 @@
1
+ import { b as WebSearchConfig, a as WebSearchProvider, W as WebSearchProviderInterface, c as WebSearchParams, f as WebSearchResponse } from './types-ZguuKEs_.js';
2
+ import { T as ToolDefinition } from './tools-DDWrco4h.js';
3
+
4
+ /**
5
+ * Web Search Module
6
+ *
7
+ * Multi-provider web search with unified API.
8
+ * Supports tree-shaking - only the provider you use gets bundled.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Option 1: Lazy loading (provider loaded on first use)
13
+ * import { executeWebSearch } from './webSearch';
14
+ * const results = await executeWebSearch(
15
+ * { query: 'latest AI news' },
16
+ * { provider: 'tavily', apiKey: 'your-api-key' }
17
+ * );
18
+ *
19
+ * // Option 2: Direct import (best for tree-shaking)
20
+ * import { tavilyProvider, executeWebSearch } from './webSearch';
21
+ * const results = await executeWebSearch(
22
+ * { query: 'latest AI news' },
23
+ * { provider: tavilyProvider, apiKey: 'your-api-key' }
24
+ * );
25
+ * ```
26
+ */
27
+
28
+ /**
29
+ * Get a provider by name (lazy loading)
30
+ *
31
+ * @param name - Provider name string
32
+ * @returns Provider interface (loaded dynamically)
33
+ */
34
+ declare function getProvider(name: WebSearchProvider): Promise<WebSearchProviderInterface>;
35
+ /**
36
+ * Get all available provider names
37
+ */
38
+ declare function getAvailableProviders(): WebSearchProvider[];
39
+ /**
40
+ * Extended config that allows passing provider directly for tree-shaking
41
+ */
42
+ interface WebSearchConfigExtended extends Omit<WebSearchConfig, "provider"> {
43
+ /**
44
+ * Provider can be either:
45
+ * - A string name (lazy loaded): "tavily", "openai", "anthropic", "google", etc.
46
+ * - A provider instance (best for tree-shaking): import { tavilyProvider } from '...'
47
+ */
48
+ provider: WebSearchProvider | WebSearchProviderInterface;
49
+ }
50
+ /**
51
+ * Execute a web search using the configured provider
52
+ *
53
+ * @param params - Search parameters (query, maxResults, searchDepth)
54
+ * @param config - Provider configuration (provider, apiKey, options)
55
+ * @returns Search results with optional AI-generated answer
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // Option 1: String provider name (lazy loaded)
60
+ * const results = await executeWebSearch(
61
+ * { query: 'What is the latest news about SpaceX?' },
62
+ * {
63
+ * provider: 'tavily',
64
+ * apiKey: process.env.TAVILY_API_KEY,
65
+ * }
66
+ * );
67
+ *
68
+ * // Option 2: Direct provider import (best for tree-shaking)
69
+ * import { tavilyProvider } from '@yourgpt/copilot-sdk/core';
70
+ * const results = await executeWebSearch(
71
+ * { query: 'What is the latest news about SpaceX?' },
72
+ * {
73
+ * provider: tavilyProvider,
74
+ * apiKey: process.env.TAVILY_API_KEY,
75
+ * }
76
+ * );
77
+ * ```
78
+ */
79
+ declare function executeWebSearch(params: WebSearchParams, config: WebSearchConfigExtended): Promise<WebSearchResponse>;
80
+ /**
81
+ * Format search results for display in AI context
82
+ *
83
+ * @param response - Web search response
84
+ * @param options - Formatting options
85
+ * @returns Formatted string for AI consumption
86
+ */
87
+ declare function formatSearchResultsForAI(response: WebSearchResponse, options?: {
88
+ includeUrls?: boolean;
89
+ includeScores?: boolean;
90
+ maxContentLength?: number;
91
+ }): string;
92
+ /**
93
+ * Create a minimal search result summary
94
+ *
95
+ * @param response - Web search response
96
+ * @returns Brief summary string
97
+ */
98
+ declare function summarizeSearchResults(response: WebSearchResponse): string;
99
+
100
+ /**
101
+ * Built-in Web Search Tool
102
+ *
103
+ * A pre-configured tool for searching the web with multiple provider support.
104
+ * Runs on the server to protect API keys.
105
+ *
106
+ * Supports tree-shaking - import providers directly for smaller bundles.
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * // Option 1: String provider (lazy loaded at runtime)
111
+ * import { createWebSearchTool } from '@yourgpt/copilot-sdk';
112
+ * const webSearch = createWebSearchTool({
113
+ * provider: 'tavily',
114
+ * apiKey: process.env.TAVILY_API_KEY,
115
+ * });
116
+ *
117
+ * // Option 2: Direct provider import (best for tree-shaking)
118
+ * import { createWebSearchTool, tavilyProvider } from '@yourgpt/copilot-sdk';
119
+ * const webSearch = createWebSearchTool({
120
+ * provider: tavilyProvider,
121
+ * apiKey: process.env.TAVILY_API_KEY,
122
+ * });
123
+ *
124
+ * // Add to your runtime
125
+ * const runtime = createRuntime({
126
+ * tools: [webSearch],
127
+ * });
128
+ * ```
129
+ */
130
+
131
+ /**
132
+ * Base web search tool definition
133
+ *
134
+ * This is the core tool definition. Use `createWebSearchTool()` to create
135
+ * a configured instance with your provider settings.
136
+ */
137
+ declare const webSearchTool: Omit<ToolDefinition<WebSearchParams>, "name">;
138
+ /**
139
+ * Create a configured web search tool
140
+ *
141
+ * Supports both string provider names (lazy loaded) and direct provider imports (tree-shakeable).
142
+ *
143
+ * @param config - Web search configuration including provider and API key
144
+ * @returns A configured tool definition ready to use
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // ===== BEST FOR TREE-SHAKING: Direct provider import =====
149
+ * import { createWebSearchTool, openaiProvider } from '@yourgpt/copilot-sdk/core';
150
+ *
151
+ * const webSearch = createWebSearchTool({
152
+ * provider: openaiProvider, // Only this provider in bundle
153
+ * apiKey: process.env.OPENAI_API_KEY,
154
+ * });
155
+ *
156
+ * // ===== STRING PROVIDERS (Lazy loaded at runtime) =====
157
+ *
158
+ * // OpenAI (uses your OpenAI API key)
159
+ * const webSearch = createWebSearchTool({
160
+ * provider: 'openai',
161
+ * apiKey: process.env.OPENAI_API_KEY,
162
+ * });
163
+ *
164
+ * // Google (uses your Google/Gemini API key)
165
+ * const webSearch = createWebSearchTool({
166
+ * provider: 'google',
167
+ * apiKey: process.env.GOOGLE_API_KEY,
168
+ * });
169
+ *
170
+ * // Tavily (AI-optimized search with answer generation)
171
+ * const webSearch = createWebSearchTool({
172
+ * provider: 'tavily',
173
+ * apiKey: process.env.TAVILY_API_KEY,
174
+ * includeAnswer: true,
175
+ * maxResults: 5,
176
+ * });
177
+ *
178
+ * // Serper (Google results)
179
+ * const webSearch = createWebSearchTool({
180
+ * provider: 'serper',
181
+ * apiKey: process.env.SERPER_API_KEY,
182
+ * });
183
+ *
184
+ * // Brave Search (privacy-focused)
185
+ * const webSearch = createWebSearchTool({
186
+ * provider: 'brave',
187
+ * apiKey: process.env.BRAVE_API_KEY,
188
+ * });
189
+ *
190
+ * // Self-hosted SearXNG (no API key needed)
191
+ * const webSearch = createWebSearchTool({
192
+ * provider: 'searxng',
193
+ * baseUrl: 'https://your-searxng-instance.com',
194
+ * });
195
+ *
196
+ * // Exa (AI-optimized semantic search)
197
+ * const webSearch = createWebSearchTool({
198
+ * provider: 'exa',
199
+ * apiKey: process.env.EXA_API_KEY,
200
+ * searchDepth: 'advanced',
201
+ * });
202
+ * ```
203
+ */
204
+ declare function createWebSearchTool(config: WebSearchConfigExtended): ToolDefinition<WebSearchParams>;
205
+
206
+ export { getAvailableProviders as a, createWebSearchTool as c, executeWebSearch as e, formatSearchResultsForAI as f, getProvider as g, summarizeSearchResults as s, webSearchTool as w };