opencode-websearch 0.2.1 → 0.2.4
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/LICENSE.md +21 -0
- package/README.md +52 -23
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +3 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -59
- package/dist/providers/anthropic.d.ts +0 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/types.d.ts +1 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -5
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nils Emil Svensson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -16,41 +16,49 @@ OpenCode will install it automatically at startup.
|
|
|
16
16
|
|
|
17
17
|
## Configuration
|
|
18
18
|
|
|
19
|
-
The plugin
|
|
19
|
+
The plugin looks for an Anthropic provider (`@ai-sdk/anthropic`) with `"websearch": true` set on at least one model. It picks up credentials however you've configured them in OpenCode -- via `/connect`, environment variables, or `options.apiKey` in your config.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
2. **Environment variable** -- falls back to `ANTHROPIC_API_KEY`
|
|
21
|
+
Add `"websearch": true` to the model you want the plugin to use for searches:
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"provider": {
|
|
26
|
+
"anthropic": {
|
|
27
|
+
"models": {
|
|
28
|
+
"claude-sonnet-4-5": {
|
|
29
|
+
"options": {
|
|
30
|
+
"websearch": true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
25
38
|
|
|
26
|
-
|
|
39
|
+
This also works with custom providers that use `@ai-sdk/anthropic`, such as a LiteLLM proxy:
|
|
27
40
|
|
|
28
41
|
```json
|
|
29
42
|
{
|
|
30
43
|
"provider": {
|
|
31
|
-
"anthropic": {
|
|
44
|
+
"my-anthropic": {
|
|
32
45
|
"npm": "@ai-sdk/anthropic",
|
|
33
46
|
"options": {
|
|
34
|
-
"
|
|
47
|
+
"baseURL": "http://localhost:4000/v1/",
|
|
48
|
+
"apiKey": "{env:MY_API_KEY}"
|
|
35
49
|
},
|
|
36
50
|
"models": {
|
|
37
|
-
"claude-sonnet-4-5": {
|
|
51
|
+
"claude-sonnet-4-5": {
|
|
52
|
+
"options": {
|
|
53
|
+
"websearch": true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
38
56
|
}
|
|
39
57
|
}
|
|
40
58
|
}
|
|
41
59
|
}
|
|
42
60
|
```
|
|
43
61
|
|
|
44
|
-
The model used for search is the first model listed in the provider config.
|
|
45
|
-
|
|
46
|
-
### Option 2: environment variable
|
|
47
|
-
|
|
48
|
-
```sh
|
|
49
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
When using the env var fallback, `claude-sonnet-4-5` is used as the default model.
|
|
53
|
-
|
|
54
62
|
## Usage
|
|
55
63
|
|
|
56
64
|
Once configured, the `web-search` tool is available to the AI agent. It accepts:
|
|
@@ -68,15 +76,36 @@ Results are returned as formatted markdown with source links.
|
|
|
68
76
|
|
|
69
77
|
## Development
|
|
70
78
|
|
|
79
|
+
### Local Development
|
|
80
|
+
|
|
81
|
+
To develop or customize the plugin locally, clone the repo and symlink the
|
|
82
|
+
source entry point into your OpenCode plugin directory:
|
|
83
|
+
|
|
71
84
|
```sh
|
|
72
|
-
|
|
85
|
+
git clone https://github.com/emilsvennesson/opencode-websearch ~/.config/opencode/opencode-websearch
|
|
86
|
+
cd ~/.config/opencode/opencode-websearch
|
|
73
87
|
bun install
|
|
88
|
+
mkdir -p ~/.config/opencode/plugin
|
|
89
|
+
ln -sf ~/.config/opencode/opencode-websearch/src/index.ts ~/.config/opencode/plugin/websearch.ts
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
OpenCode will load the plugin directly from source on startup. Any edits to the
|
|
93
|
+
files in `src/` take effect next time you start OpenCode.
|
|
74
94
|
|
|
75
|
-
|
|
76
|
-
|
|
95
|
+
> **Note:** When using the symlink approach, remove `"opencode-websearch"` from
|
|
96
|
+
> the `plugin` array in your `opencode.json` to avoid loading the plugin twice.
|
|
77
97
|
|
|
78
|
-
|
|
79
|
-
|
|
98
|
+
### Commands
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
bun install # install dependencies
|
|
102
|
+
bun run format # auto-format source files
|
|
103
|
+
bun run format:check # verify formatting (no changes)
|
|
104
|
+
bun run lint # run oxlint
|
|
105
|
+
bun run lint:fix # auto-fix lint issues
|
|
106
|
+
bun run typecheck # type check with tsc
|
|
107
|
+
bun run check # format:check + lint + typecheck (full quality gate)
|
|
108
|
+
bun run build # ESM bundle + declaration files → dist/
|
|
80
109
|
```
|
|
81
110
|
|
|
82
111
|
## License
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AnthropicConfig } from "./types.js";
|
|
2
2
|
interface ProviderData {
|
|
3
|
+
id: string;
|
|
4
|
+
key?: string;
|
|
3
5
|
models: Record<string, {
|
|
4
6
|
api: {
|
|
5
7
|
npm: string;
|
|
@@ -7,7 +9,6 @@ interface ProviderData {
|
|
|
7
9
|
id: string;
|
|
8
10
|
options: Record<string, unknown>;
|
|
9
11
|
}>;
|
|
10
|
-
key?: string;
|
|
11
12
|
options: Record<string, unknown>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,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,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AA4BD;;;GAGG;AACH,QAAA,MAAM,oBAAoB,GAAI,WAAW,YAAY,EAAE,KAAG,eAAe,GAAG,IAiB3E,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,11 +1,10 @@
|
|
|
1
1
|
declare const ANTHROPIC_NPM_PACKAGE = "@ai-sdk/anthropic";
|
|
2
|
-
declare const DEFAULT_SEARCH_USES =
|
|
2
|
+
declare const DEFAULT_SEARCH_USES = 8;
|
|
3
3
|
declare const EMPTY_LENGTH = 0;
|
|
4
4
|
declare const MAX_RESPONSE_TOKENS = 16000;
|
|
5
|
-
declare const MAX_SEARCH_USES = 10;
|
|
6
5
|
declare const MIN_QUERY_LENGTH = 2;
|
|
7
|
-
declare const MIN_SEARCH_USES = 1;
|
|
8
6
|
declare const MONTH_OFFSET = 1;
|
|
9
7
|
declare const PAD_LENGTH = 2;
|
|
10
|
-
|
|
8
|
+
declare const SEARCH_SYSTEM_PROMPT = "You are an assistant for performing a web search tool use";
|
|
9
|
+
export { ANTHROPIC_NPM_PACKAGE, DEFAULT_SEARCH_USES, EMPTY_LENGTH, MAX_RESPONSE_TOKENS, MIN_QUERY_LENGTH, MONTH_OFFSET, PAD_LENGTH, SEARCH_SYSTEM_PROMPT, };
|
|
11
10
|
//# 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,qBAAqB,sBAAsB,CAAC;AAClD,QAAA,MAAM,mBAAmB,IAAI,CAAC;AAC9B,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,mBAAmB,QAAS,CAAC;AACnC,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,gBAAgB,IAAI,CAAC;AAC3B,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,UAAU,IAAI,CAAC;AACrB,QAAA,MAAM,oBAAoB,8DAA8D,CAAC;AAEzF,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,oBAAoB,GACrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,14 +5,12 @@ declare const _default: (input: import("@opencode-ai/plugin").PluginInput) => Pr
|
|
|
5
5
|
args: {
|
|
6
6
|
allowed_domains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
7
7
|
blocked_domains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
8
|
-
max_uses: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
9
8
|
query: import("zod").ZodString;
|
|
10
9
|
};
|
|
11
10
|
execute(args: {
|
|
12
11
|
query: string;
|
|
13
12
|
allowed_domains?: string[] | undefined;
|
|
14
13
|
blocked_domains?: string[] | undefined;
|
|
15
|
-
max_uses?: number | undefined;
|
|
16
14
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
17
15
|
};
|
|
18
16
|
};
|
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,wBAgEoB"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { tool } from "@opencode-ai/plugin";
|
|
3
|
+
|
|
1
4
|
// src/constants.ts
|
|
2
5
|
var ANTHROPIC_NPM_PACKAGE = "@ai-sdk/anthropic";
|
|
3
|
-
var DEFAULT_SEARCH_USES =
|
|
6
|
+
var DEFAULT_SEARCH_USES = 8;
|
|
4
7
|
var EMPTY_LENGTH = 0;
|
|
5
8
|
var MAX_RESPONSE_TOKENS = 16000;
|
|
6
|
-
var MAX_SEARCH_USES = 10;
|
|
7
9
|
var MIN_QUERY_LENGTH = 2;
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
// src/index.ts
|
|
11
|
-
import { tool } from "@opencode-ai/plugin";
|
|
10
|
+
var SEARCH_SYSTEM_PROMPT = "You are an assistant for performing a web search tool use";
|
|
12
11
|
|
|
13
12
|
// src/config.ts
|
|
14
13
|
var isAnthropicModel = (model) => model.api.npm === ANTHROPIC_NPM_PACKAGE;
|
|
15
14
|
var hasWebSearch = (model) => model.options.websearch === true;
|
|
16
15
|
var normalizeBaseURL = (url) => url.replace(/\/v1\/?$/, "");
|
|
16
|
+
var extractApiKey = (options) => {
|
|
17
|
+
if (typeof options.apiKey !== "string") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
return options.apiKey;
|
|
21
|
+
};
|
|
17
22
|
var extractBaseURL = (options) => {
|
|
18
23
|
if (typeof options.baseURL !== "string") {
|
|
19
24
|
return;
|
|
@@ -24,11 +29,12 @@ var resolveFromProviders = (providers) => {
|
|
|
24
29
|
for (const provider of providers) {
|
|
25
30
|
for (const model of Object.values(provider.models)) {
|
|
26
31
|
if (isAnthropicModel(model) && hasWebSearch(model)) {
|
|
27
|
-
|
|
32
|
+
const apiKey = provider.key ?? extractApiKey(provider.options);
|
|
33
|
+
if (!apiKey) {
|
|
28
34
|
return null;
|
|
29
35
|
}
|
|
30
36
|
return {
|
|
31
|
-
apiKey
|
|
37
|
+
apiKey,
|
|
32
38
|
baseURL: extractBaseURL(provider.options),
|
|
33
39
|
model: model.id
|
|
34
40
|
};
|
|
@@ -69,46 +75,34 @@ Steps:
|
|
|
69
75
|
|
|
70
76
|
// src/providers/anthropic.ts
|
|
71
77
|
import Anthropic, { APIError } from "@anthropic-ai/sdk";
|
|
72
|
-
var
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
78
|
+
var processBlock = (block) => {
|
|
79
|
+
if (block.type === "text" && block.text.trim().length > EMPTY_LENGTH) {
|
|
80
|
+
return block.text.trim();
|
|
75
81
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (Array.isArray(block.content)) {
|
|
80
|
-
const searchResults = block.content;
|
|
81
|
-
if (searchResults.length === EMPTY_LENGTH) {
|
|
82
|
-
results.push("No results found.");
|
|
83
|
-
} else {
|
|
84
|
-
results.push(`
|
|
85
|
-
Found ${searchResults.length} results:
|
|
86
|
-
`);
|
|
87
|
-
for (const result of searchResults) {
|
|
88
|
-
results.push(formatSearchResult(result));
|
|
89
|
-
}
|
|
82
|
+
if (block.type === "web_search_tool_result") {
|
|
83
|
+
if (!Array.isArray(block.content)) {
|
|
84
|
+
return `Web search error: ${block.content.error_code}`;
|
|
90
85
|
}
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
return block.content.map((sr) => ({
|
|
87
|
+
title: sr.title,
|
|
88
|
+
url: sr.url
|
|
89
|
+
}));
|
|
93
90
|
}
|
|
91
|
+
return null;
|
|
94
92
|
};
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (block.type === "text" && block.text) {
|
|
105
|
-
results.push(`
|
|
106
|
-
${block.text}`);
|
|
93
|
+
var processResponseBlocks = (query, content) => {
|
|
94
|
+
const results = [];
|
|
95
|
+
for (const block of content) {
|
|
96
|
+
const result = processBlock(block);
|
|
97
|
+
if (result !== null) {
|
|
98
|
+
results.push(result);
|
|
99
|
+
}
|
|
107
100
|
}
|
|
101
|
+
return { query, results };
|
|
108
102
|
};
|
|
109
103
|
var buildWebSearchTool = (args) => {
|
|
110
104
|
const searchTool = {
|
|
111
|
-
max_uses:
|
|
105
|
+
max_uses: DEFAULT_SEARCH_USES,
|
|
112
106
|
name: "web_search",
|
|
113
107
|
type: "web_search_20250305"
|
|
114
108
|
};
|
|
@@ -138,13 +132,6 @@ var createAnthropicClient = (config) => {
|
|
|
138
132
|
}
|
|
139
133
|
return new Anthropic(options);
|
|
140
134
|
};
|
|
141
|
-
var appendUsageInfo = (usage, results) => {
|
|
142
|
-
if (usage.server_tool_use?.web_search_requests) {
|
|
143
|
-
results.push(`
|
|
144
|
-
---
|
|
145
|
-
Searches performed: ${usage.server_tool_use.web_search_requests}`);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
135
|
var executeSearch = async (config, args) => {
|
|
149
136
|
const client = createAnthropicClient(config);
|
|
150
137
|
const webSearchTool = buildWebSearchTool(args);
|
|
@@ -152,21 +139,17 @@ var executeSearch = async (config, args) => {
|
|
|
152
139
|
max_tokens: MAX_RESPONSE_TOKENS,
|
|
153
140
|
messages: [
|
|
154
141
|
{
|
|
155
|
-
content: `Perform a web search for: ${args.query}`,
|
|
142
|
+
content: `Perform a web search for the query: ${args.query}`,
|
|
156
143
|
role: "user"
|
|
157
144
|
}
|
|
158
145
|
],
|
|
159
146
|
model: config.model,
|
|
147
|
+
system: SEARCH_SYSTEM_PROMPT,
|
|
160
148
|
tools: [webSearchTool]
|
|
161
149
|
});
|
|
162
|
-
const results = [];
|
|
163
150
|
const content = response.content;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
appendUsageInfo(response.usage, results);
|
|
168
|
-
return results.join(`
|
|
169
|
-
`) || "No results returned from web search.";
|
|
151
|
+
const structured = processResponseBlocks(args.query, content);
|
|
152
|
+
return JSON.stringify(structured);
|
|
170
153
|
};
|
|
171
154
|
|
|
172
155
|
// src/helpers.ts
|
|
@@ -186,10 +169,9 @@ var src_default = async (input) => {
|
|
|
186
169
|
tool: {
|
|
187
170
|
"web-search": tool({
|
|
188
171
|
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("
|
|
191
|
-
|
|
192
|
-
query: tool.schema.string().min(MIN_QUERY_LENGTH).describe("The search query to execute")
|
|
172
|
+
allowed_domains: tool.schema.array(tool.schema.string()).optional().describe("Only include search results from these domains"),
|
|
173
|
+
blocked_domains: tool.schema.array(tool.schema.string()).optional().describe("Never include search results from these domains"),
|
|
174
|
+
query: tool.schema.string().min(MIN_QUERY_LENGTH).describe("The search query to use")
|
|
193
175
|
},
|
|
194
176
|
description: `- Allows OpenCode to search the web and use the results to inform responses
|
|
195
177
|
- Provides up-to-date information for current events and recent data
|
|
@@ -3,7 +3,6 @@ declare const formatErrorMessage: (error: unknown) => string;
|
|
|
3
3
|
declare const executeSearch: (config: AnthropicConfig, args: {
|
|
4
4
|
allowed_domains?: string[];
|
|
5
5
|
blocked_domains?: string[];
|
|
6
|
-
max_uses?: number;
|
|
7
6
|
query: string;
|
|
8
7
|
}) => Promise<string>;
|
|
9
8
|
export { executeSearch, formatErrorMessage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAiC,MAAM,aAAa,CAAC;AAgF7E,QAAA,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,MAQ5C,CAAC;AAcF,QAAA,MAAM,aAAa,GACjB,QAAQ,eAAe,EACvB,MAAM;IACJ,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf,KACA,OAAO,CAAC,MAAM,CAqBhB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ interface AnthropicConfig {
|
|
|
4
4
|
model: string;
|
|
5
5
|
}
|
|
6
6
|
interface WebSearchResult {
|
|
7
|
-
page_age?: string;
|
|
8
7
|
title: string;
|
|
9
8
|
type: "web_search_result";
|
|
10
9
|
url: string;
|
|
@@ -25,16 +24,9 @@ interface ServerToolUse {
|
|
|
25
24
|
name: string;
|
|
26
25
|
type: "server_tool_use";
|
|
27
26
|
}
|
|
28
|
-
interface SearchUsage {
|
|
29
|
-
input_tokens: number;
|
|
30
|
-
output_tokens: number;
|
|
31
|
-
server_tool_use?: {
|
|
32
|
-
web_search_requests?: number;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
27
|
type ContentBlock = {
|
|
36
28
|
text: string;
|
|
37
29
|
type: "text";
|
|
38
30
|
} | ServerToolUse | WebSearchToolResult;
|
|
39
|
-
export { AnthropicConfig, ContentBlock,
|
|
31
|
+
export { AnthropicConfig, ContentBlock, ServerToolUse, WebSearchResult, WebSearchToolResult };
|
|
40
32
|
//# 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;AAID,UAAU,eAAe;IACvB,
|
|
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,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,KAAK,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-websearch",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Claude Code's WebSearch tool
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Web search plugin for OpenCode, inspired by Claude Code's WebSearch tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -37,9 +37,6 @@
|
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/emilsvennesson/opencode-websearch.git"
|
|
39
39
|
},
|
|
40
|
-
"engines": {
|
|
41
|
-
"node": ">=24"
|
|
42
|
-
},
|
|
43
40
|
"license": "MIT",
|
|
44
41
|
"dependencies": {
|
|
45
42
|
"@anthropic-ai/sdk": "^0.52.0"
|