opencode-websearch 0.1.2 → 0.2.1
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/config.d.ts +17 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/helpers.d.ts +1 -3
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -188
- package/dist/types.d.ts +1 -23
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnthropicConfig } from "./types.js";
|
|
2
|
+
interface ProviderData {
|
|
3
|
+
models: Record<string, {
|
|
4
|
+
api: {
|
|
5
|
+
npm: string;
|
|
6
|
+
};
|
|
7
|
+
id: string;
|
|
8
|
+
options: Record<string, unknown>;
|
|
9
|
+
}>;
|
|
10
|
+
key?: string;
|
|
11
|
+
options: Record<string, unknown>;
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* 2. ANTHROPIC_API_KEY environment variable (fallback)
|
|
14
|
+
* Scan providers returned by the SDK for the first Anthropic model
|
|
15
|
+
* with `websearch: true` set in its options.
|
|
6
16
|
*/
|
|
7
|
-
declare const
|
|
8
|
-
declare const formatConfigError: (
|
|
9
|
-
export { formatConfigError,
|
|
17
|
+
declare const resolveFromProviders: (providers: ProviderData[]) => AnthropicConfig | null;
|
|
18
|
+
declare const formatConfigError: () => string;
|
|
19
|
+
export { formatConfigError, ProviderData, resolveFromProviders };
|
|
10
20
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAI7C,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAC/F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAqBD;;;GAGG;AACH,QAAA,MAAM,oBAAoB,GAAI,WAAW,YAAY,EAAE,KAAG,eAAe,GAAG,IAgB3E,CAAC;AAIF,QAAA,MAAM,iBAAiB,QAAO,MA6B0B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const ANTHROPIC_NPM_PACKAGE = "@ai-sdk/anthropic";
|
|
2
2
|
declare const DEFAULT_SEARCH_USES = 5;
|
|
3
3
|
declare const EMPTY_LENGTH = 0;
|
|
4
|
-
declare const ENV_VAR_CAPTURE_GROUP = 1;
|
|
5
|
-
declare const FIRST_MODEL_INDEX = 0;
|
|
6
4
|
declare const MAX_RESPONSE_TOKENS = 16000;
|
|
7
5
|
declare const MAX_SEARCH_USES = 10;
|
|
8
6
|
declare const MIN_QUERY_LENGTH = 2;
|
|
9
7
|
declare const MIN_SEARCH_USES = 1;
|
|
10
8
|
declare const MONTH_OFFSET = 1;
|
|
11
9
|
declare const PAD_LENGTH = 2;
|
|
12
|
-
export {
|
|
10
|
+
export { ANTHROPIC_NPM_PACKAGE, DEFAULT_SEARCH_USES, EMPTY_LENGTH, MAX_RESPONSE_TOKENS, MAX_SEARCH_USES, MIN_QUERY_LENGTH, MIN_SEARCH_USES, MONTH_OFFSET, PAD_LENGTH, };
|
|
13
11
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,qBAAqB,sBAAsB,CAAC;AAClD,QAAA,MAAM,mBAAmB,IAAI,CAAC;AAC9B,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,mBAAmB,QAAS,CAAC;AACnC,QAAA,MAAM,eAAe,KAAK,CAAC;AAC3B,QAAA,MAAM,gBAAgB,IAAI,CAAC;AAC3B,QAAA,MAAM,eAAe,IAAI,CAAC;AAC1B,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,UAAU,IAAI,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,UAAU,GACX,CAAC"}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
declare const getTodayDate: () => string;
|
|
2
|
-
declare const resolveEnvVar: (value: string) => string;
|
|
3
2
|
declare const getCurrentMonthYear: () => string;
|
|
4
|
-
|
|
5
|
-
export { getCurrentMonthYear, getTodayDate, normalizeBaseURL, resolveEnvVar };
|
|
3
|
+
export { getCurrentMonthYear, getTodayDate };
|
|
6
4
|
//# sourceMappingURL=helpers.d.ts.map
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,YAAY,QAAO,MAMxB,CAAC;AAEF,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,YAAY,QAAO,MAMxB,CAAC;AAEF,QAAA,MAAM,mBAAmB,QAAO,MAC4C,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,wBAsEoB"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// src/constants.ts
|
|
2
|
-
var
|
|
2
|
+
var ANTHROPIC_NPM_PACKAGE = "@ai-sdk/anthropic";
|
|
3
3
|
var DEFAULT_SEARCH_USES = 5;
|
|
4
4
|
var EMPTY_LENGTH = 0;
|
|
5
|
-
var ENV_VAR_CAPTURE_GROUP = 1;
|
|
6
|
-
var FIRST_MODEL_INDEX = 0;
|
|
7
5
|
var MAX_RESPONSE_TOKENS = 16000;
|
|
8
6
|
var MAX_SEARCH_USES = 10;
|
|
9
7
|
var MIN_QUERY_LENGTH = 2;
|
|
@@ -12,6 +10,63 @@ var MIN_SEARCH_USES = 1;
|
|
|
12
10
|
// src/index.ts
|
|
13
11
|
import { tool } from "@opencode-ai/plugin";
|
|
14
12
|
|
|
13
|
+
// src/config.ts
|
|
14
|
+
var isAnthropicModel = (model) => model.api.npm === ANTHROPIC_NPM_PACKAGE;
|
|
15
|
+
var hasWebSearch = (model) => model.options.websearch === true;
|
|
16
|
+
var normalizeBaseURL = (url) => url.replace(/\/v1\/?$/, "");
|
|
17
|
+
var extractBaseURL = (options) => {
|
|
18
|
+
if (typeof options.baseURL !== "string") {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
return normalizeBaseURL(options.baseURL);
|
|
22
|
+
};
|
|
23
|
+
var resolveFromProviders = (providers) => {
|
|
24
|
+
for (const provider of providers) {
|
|
25
|
+
for (const model of Object.values(provider.models)) {
|
|
26
|
+
if (isAnthropicModel(model) && hasWebSearch(model)) {
|
|
27
|
+
if (!provider.key) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
apiKey: provider.key,
|
|
32
|
+
baseURL: extractBaseURL(provider.options),
|
|
33
|
+
model: model.id
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
var formatConfigError = () => `Error: web-search requires an Anthropic provider with \`websearch: true\` set on at least one model.
|
|
41
|
+
|
|
42
|
+
No model with \`"websearch": true\` was found in your opencode.json configuration.
|
|
43
|
+
|
|
44
|
+
To fix this, add an Anthropic provider to your opencode.json and set \`"websearch": true\` in the options of the model you want to use for web searches:
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
"provider": {
|
|
48
|
+
"anthropic": {
|
|
49
|
+
"npm": "@ai-sdk/anthropic",
|
|
50
|
+
"options": {
|
|
51
|
+
"apiKey": "{env:ANTHROPIC_API_KEY}"
|
|
52
|
+
},
|
|
53
|
+
"models": {
|
|
54
|
+
"claude-sonnet-4-5": {
|
|
55
|
+
"options": {
|
|
56
|
+
"websearch": true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Steps:
|
|
65
|
+
1. Open your opencode.json (project root, .opencode/opencode.json, or ~/.config/opencode/opencode.json)
|
|
66
|
+
2. Ensure you have an Anthropic provider configured with a valid API key
|
|
67
|
+
3. Add \`"websearch": true\` to the \`options\` of the Claude model you want to use for web search
|
|
68
|
+
4. Restart OpenCode to pick up the configuration change`;
|
|
69
|
+
|
|
15
70
|
// src/providers/anthropic.ts
|
|
16
71
|
import Anthropic, { APIError } from "@anthropic-ai/sdk";
|
|
17
72
|
var formatSearchResult = (result) => {
|
|
@@ -114,181 +169,29 @@ var executeSearch = async (config, args) => {
|
|
|
114
169
|
`) || "No results returned from web search.";
|
|
115
170
|
};
|
|
116
171
|
|
|
117
|
-
// src/config.ts
|
|
118
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
119
|
-
|
|
120
172
|
// src/helpers.ts
|
|
121
|
-
var resolveEnvVar = (value) => {
|
|
122
|
-
const match = value.match(/^\{env:(\w+)\}$/);
|
|
123
|
-
if (match?.[ENV_VAR_CAPTURE_GROUP]) {
|
|
124
|
-
return process.env[match[ENV_VAR_CAPTURE_GROUP]] ?? "";
|
|
125
|
-
}
|
|
126
|
-
return value;
|
|
127
|
-
};
|
|
128
173
|
var getCurrentMonthYear = () => new Date().toLocaleDateString("en-US", { month: "long", year: "numeric" });
|
|
129
|
-
var normalizeBaseURL = (url) => url.replace(/\/v1\/?$/, "");
|
|
130
174
|
|
|
131
|
-
// src/
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
join(process.cwd(), ".opencode", "opencode.json"),
|
|
137
|
-
join(homedir(), ".config", "opencode", "opencode.json")
|
|
138
|
-
];
|
|
139
|
-
var parseConfigFile = (configPath) => {
|
|
140
|
-
try {
|
|
141
|
-
return JSON.parse(readFileSync(configPath, "utf8"));
|
|
142
|
-
} catch (error) {
|
|
143
|
-
if (error instanceof SyntaxError) {
|
|
144
|
-
return `Failed to parse ${configPath}: ${error.message}`;
|
|
145
|
-
}
|
|
146
|
-
return `Failed to parse ${configPath}: ${String(error)}`;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
var resolveProviderApiKey = (ctx, rawApiKey) => {
|
|
150
|
-
const apiKey = resolveEnvVar(rawApiKey);
|
|
151
|
-
if (apiKey) {
|
|
152
|
-
return apiKey;
|
|
153
|
-
}
|
|
154
|
-
const envMatch = rawApiKey.match(/^\{env:(\w+)\}$/);
|
|
155
|
-
if (envMatch) {
|
|
156
|
-
ctx.errors.push(`${ctx.configPath}: Environment variable ${envMatch[ENV_VAR_CAPTURE_GROUP]} is not set`);
|
|
157
|
-
} else {
|
|
158
|
-
ctx.errors.push(`${ctx.configPath}: Provider "${ctx.providerName}" has empty apiKey`);
|
|
159
|
-
}
|
|
160
|
-
return;
|
|
161
|
-
};
|
|
162
|
-
var resolveModelName = (provider) => {
|
|
163
|
-
if (!provider.models) {
|
|
164
|
-
return DEFAULT_MODEL;
|
|
165
|
-
}
|
|
166
|
-
const models = Object.keys(provider.models);
|
|
167
|
-
return models[FIRST_MODEL_INDEX] ?? DEFAULT_MODEL;
|
|
168
|
-
};
|
|
169
|
-
var resolveBaseURL = (provider) => {
|
|
170
|
-
if (!provider.options?.baseURL) {
|
|
171
|
-
return;
|
|
175
|
+
// src/index.ts
|
|
176
|
+
var resolveConfig = async (client) => {
|
|
177
|
+
const { data } = await client.config.providers();
|
|
178
|
+
if (data) {
|
|
179
|
+
return resolveFromProviders(data.providers);
|
|
172
180
|
}
|
|
173
|
-
return
|
|
181
|
+
return null;
|
|
174
182
|
};
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (!provider.options?.apiKey) {
|
|
180
|
-
ctx.errors.push(`${ctx.configPath}: Provider "${ctx.providerName}" has no apiKey configured`);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const apiKey = resolveProviderApiKey(ctx, provider.options.apiKey);
|
|
184
|
-
if (!apiKey) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
183
|
+
var src_default = async (input) => {
|
|
184
|
+
let config = null;
|
|
187
185
|
return {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (resolved) {
|
|
198
|
-
return resolved;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return;
|
|
202
|
-
};
|
|
203
|
-
var scanConfigFile = (configPath, errors) => {
|
|
204
|
-
if (!existsSync(configPath)) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const parsed = parseConfigFile(configPath);
|
|
208
|
-
if (typeof parsed === "string") {
|
|
209
|
-
errors.push(parsed);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (!parsed.provider) {
|
|
213
|
-
errors.push(`${configPath}: No "provider" field found`);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
return scanProviders(configPath, parsed.provider, errors);
|
|
217
|
-
};
|
|
218
|
-
var scanAllConfigFiles = (errors) => {
|
|
219
|
-
for (const configPath of CONFIG_PATHS) {
|
|
220
|
-
const resolved = scanConfigFile(configPath, errors);
|
|
221
|
-
if (resolved) {
|
|
222
|
-
return resolved;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return;
|
|
226
|
-
};
|
|
227
|
-
var getEnvFallback = () => {
|
|
228
|
-
const envApiKey = process.env.ANTHROPIC_API_KEY;
|
|
229
|
-
if (envApiKey) {
|
|
230
|
-
return {
|
|
231
|
-
config: {
|
|
232
|
-
apiKey: envApiKey,
|
|
233
|
-
model: DEFAULT_MODEL
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return;
|
|
238
|
-
};
|
|
239
|
-
var getAnthropicConfig = () => {
|
|
240
|
-
const errors = [];
|
|
241
|
-
const fromConfig = scanAllConfigFiles(errors);
|
|
242
|
-
if (fromConfig) {
|
|
243
|
-
return { config: fromConfig };
|
|
244
|
-
}
|
|
245
|
-
const fromEnv = getEnvFallback();
|
|
246
|
-
if (fromEnv) {
|
|
247
|
-
return fromEnv;
|
|
248
|
-
}
|
|
249
|
-
if (errors.length > EMPTY_LENGTH) {
|
|
250
|
-
return { config: null, error: errors.join(`
|
|
251
|
-
`) };
|
|
252
|
-
}
|
|
253
|
-
return { config: null };
|
|
254
|
-
};
|
|
255
|
-
var formatConfigError = (error) => {
|
|
256
|
-
let hint = "";
|
|
257
|
-
if (error) {
|
|
258
|
-
hint = `
|
|
259
|
-
|
|
260
|
-
${error}`;
|
|
261
|
-
}
|
|
262
|
-
return `Error: web-search requires an Anthropic API key.
|
|
263
|
-
|
|
264
|
-
Set the ANTHROPIC_API_KEY environment variable, or add an Anthropic provider to your opencode.json:
|
|
265
|
-
|
|
266
|
-
{
|
|
267
|
-
"provider": {
|
|
268
|
-
"anthropic": {
|
|
269
|
-
"npm": "@ai-sdk/anthropic",
|
|
270
|
-
"options": {
|
|
271
|
-
"apiKey": "{env:ANTHROPIC_API_KEY}"
|
|
272
|
-
},
|
|
273
|
-
"models": {
|
|
274
|
-
"claude-sonnet-4-5": { "name": "Claude Sonnet 4.5" }
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}${hint}`;
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// src/index.ts
|
|
282
|
-
var src_default = async () => ({
|
|
283
|
-
tool: {
|
|
284
|
-
"web-search": tool({
|
|
285
|
-
args: {
|
|
286
|
-
allowed_domains: tool.schema.array(tool.schema.string()).optional().describe("Only include results from these domains"),
|
|
287
|
-
blocked_domains: tool.schema.array(tool.schema.string()).optional().describe("Exclude results from these domains"),
|
|
288
|
-
max_uses: tool.schema.number().min(MIN_SEARCH_USES).max(MAX_SEARCH_USES).optional().describe("Maximum number of searches to perform (default: 5)"),
|
|
289
|
-
query: tool.schema.string().min(MIN_QUERY_LENGTH).describe("The search query to execute")
|
|
290
|
-
},
|
|
291
|
-
description: `- Allows OpenCode to search the web and use the results to inform responses
|
|
186
|
+
tool: {
|
|
187
|
+
"web-search": tool({
|
|
188
|
+
args: {
|
|
189
|
+
allowed_domains: tool.schema.array(tool.schema.string()).optional().describe("Only include results from these domains"),
|
|
190
|
+
blocked_domains: tool.schema.array(tool.schema.string()).optional().describe("Exclude results from these domains"),
|
|
191
|
+
max_uses: tool.schema.number().min(MIN_SEARCH_USES).max(MAX_SEARCH_USES).optional().describe("Maximum number of searches to perform (default: 5)"),
|
|
192
|
+
query: tool.schema.string().min(MIN_QUERY_LENGTH).describe("The search query to execute")
|
|
193
|
+
},
|
|
194
|
+
description: `- Allows OpenCode to search the web and use the results to inform responses
|
|
292
195
|
- Provides up-to-date information for current events and recent data
|
|
293
196
|
- Returns search result information formatted as search result blocks, including links as markdown hyperlinks
|
|
294
197
|
- Use this tool for accessing information beyond the model's knowledge cutoff
|
|
@@ -312,23 +215,26 @@ Usage notes:
|
|
|
312
215
|
IMPORTANT - Use the correct year in search queries:
|
|
313
216
|
- It is currently ${getCurrentMonthYear()}. You MUST use this when searching for recent information, documentation, or current events.
|
|
314
217
|
- Example: If the user asks for "latest React docs", search for "React documentation" with the current year, NOT last year`,
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
218
|
+
async execute(args) {
|
|
219
|
+
if (!config) {
|
|
220
|
+
config = await resolveConfig(input.client);
|
|
221
|
+
}
|
|
222
|
+
if (!config) {
|
|
223
|
+
return formatConfigError();
|
|
224
|
+
}
|
|
225
|
+
if (args.allowed_domains && args.blocked_domains) {
|
|
226
|
+
return "Error: Cannot specify both allowed_domains and blocked_domains.";
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
return await executeSearch(config, args);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
return formatErrorMessage(error);
|
|
232
|
+
}
|
|
322
233
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
})
|
|
330
|
-
}
|
|
331
|
-
});
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
};
|
|
332
238
|
export {
|
|
333
239
|
src_default as default
|
|
334
240
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -3,28 +3,6 @@ interface AnthropicConfig {
|
|
|
3
3
|
baseURL?: string;
|
|
4
4
|
model: string;
|
|
5
5
|
}
|
|
6
|
-
interface OpenCodeProvider {
|
|
7
|
-
models?: Record<string, {
|
|
8
|
-
name?: string;
|
|
9
|
-
}>;
|
|
10
|
-
npm?: string;
|
|
11
|
-
options?: {
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
baseURL?: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
interface OpenCodeConfig {
|
|
17
|
-
provider?: Record<string, OpenCodeProvider>;
|
|
18
|
-
}
|
|
19
|
-
interface ConfigResult {
|
|
20
|
-
config: AnthropicConfig | null;
|
|
21
|
-
error?: string;
|
|
22
|
-
}
|
|
23
|
-
interface ProviderContext {
|
|
24
|
-
configPath: string;
|
|
25
|
-
errors: string[];
|
|
26
|
-
providerName: string;
|
|
27
|
-
}
|
|
28
6
|
interface WebSearchResult {
|
|
29
7
|
page_age?: string;
|
|
30
8
|
title: string;
|
|
@@ -58,5 +36,5 @@ type ContentBlock = {
|
|
|
58
36
|
text: string;
|
|
59
37
|
type: "text";
|
|
60
38
|
} | ServerToolUse | WebSearchToolResult;
|
|
61
|
-
export { AnthropicConfig,
|
|
39
|
+
export { AnthropicConfig, ContentBlock, SearchUsage, ServerToolUse, WebSearchResult, WebSearchToolResult, };
|
|
62
40
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAID,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,eAAe,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,8BAA8B,CAAA;KAAE,CAAC;IAC1F,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAED,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,UAAU,WAAW;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE;QAAE,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD;AAED,KAAK,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAEzF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,mBAAmB,GACpB,CAAC"}
|