opencode-search-plugin 3.0.0 → 3.1.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.
- package/README.md +5 -5
- package/README.zh-CN.md +5 -5
- package/package.json +1 -1
- package/plugins/brave-search.ts +4 -4
package/README.md
CHANGED
|
@@ -31,12 +31,12 @@ This repository adds plugins for thirteen more of them, taking the pool from fiv
|
|
|
31
31
|
|
|
32
32
|
## Install
|
|
33
33
|
|
|
34
|
-
Three equivalent ways to install; pick one. **npm is recommended**: a version published to the registry is immutable, so a pinned `@3.
|
|
34
|
+
Three equivalent ways to install; pick one. **npm is recommended**: a version published to the registry is immutable, so a pinned `@3.1.0` always installs the same bytes, whereas a GitHub tag can in principle be moved by a maintainer to point at a different commit. The first two install the same complete package (all thirteen); use the third for one or two files only.
|
|
35
35
|
|
|
36
36
|
### 1. From npm (recommended)
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
# add @3.
|
|
39
|
+
# add @3.1.0 to pin
|
|
40
40
|
opencode plugin add opencode-search-plugin
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -52,7 +52,7 @@ or declare it in `opencode.json(c)`:
|
|
|
52
52
|
### 2. From GitHub
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
# add #v3.
|
|
55
|
+
# add #v3.1.0 to pin
|
|
56
56
|
opencode plugin add github:guotree/opencode-search-plugin
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -134,7 +134,7 @@ opencode plugin update github:guotree/opencode-search-plugin
|
|
|
134
134
|
opencode plugin update
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
The target is the specifier that was configured: an npm install is named by its package name, a GitHub install answers only to its `github:` form; naming it by its bare package name fails with `Plugin is not configured`. Run `opencode plugin check` first to see what is outdated. An install without a pinned version follows new releases; a pinned one (`@3.
|
|
137
|
+
The target is the specifier that was configured: an npm install is named by its package name, a GitHub install answers only to its `github:` form; naming it by its bare package name fails with `Plugin is not configured`. Run `opencode plugin check` first to see what is outdated. An install without a pinned version follows new releases; a pinned one (`@3.1.0` on npm, `#v3.1.0` on GitHub) stays on its pin until you re-run `plugin add` with a newer pin or edit the specifier in `opencode.json(c)`. A locally copied file is upgraded by copying the new version over the old one.
|
|
138
138
|
|
|
139
139
|
## Uninstall
|
|
140
140
|
|
|
@@ -178,7 +178,7 @@ The namespace also shows on the display name: `/connect` lists each of this pack
|
|
|
178
178
|
| --- | --- | --- | --- | --- |
|
|
179
179
|
| AnySearch | `osp-anysearch` | `OSP_ANYSEARCH_API_KEY` | yes | Free tier per IP; intent router, `cn`/`intl` zones |
|
|
180
180
|
| Bocha | `osp-bocha` | `OSP_BOCHA_API_KEY` | no | Bing-compatible results; billed per search, and by the token when a summary is asked for |
|
|
181
|
-
| Brave Search | `osp-brave` | `
|
|
181
|
+
| Brave Search | `osp-brave` | `OSP_BRAVE_API_KEY` | no | Independent index, 20 results max |
|
|
182
182
|
| DeepSeek | `osp-deepseek` | `OSP_DEEPSEEK_API_KEY` | no | In-house index; $0.75 per 1,000 successful requests; 5 QPS cap |
|
|
183
183
|
| Jina | `osp-jina` | `OSP_JINA_API_KEY` | no | Page content is opt-in because it is token-billed |
|
|
184
184
|
| Keenable | `osp-keenable` | `OSP_KEENABLE_API_KEY` | yes | 100,000 requests a month with a key; keyless tier is per IP |
|
package/README.zh-CN.md
CHANGED
|
@@ -31,12 +31,12 @@ OpenCode v2 内置了五个网页搜索 provider:`exa`、`firecrawl`、`parall
|
|
|
31
31
|
|
|
32
32
|
## 安装
|
|
33
33
|
|
|
34
|
-
三种方式等价,任选其一。**推荐 npm**:已发布到 registry 的版本不可变,固定 `@3.
|
|
34
|
+
三种方式等价,任选其一。**推荐 npm**:已发布到 registry 的版本不可变,固定 `@3.1.0` 后每次安装都拿到同一份字节;GitHub 的 tag 在理论上可以被维护者移动、指向别的 commit。前两种装的是同一个完整包(十三个全有),只想用一两个就用第三种。
|
|
35
35
|
|
|
36
36
|
### 1. 从 npm 安装(推荐)
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
# 追加 @3.
|
|
39
|
+
# 追加 @3.1.0 可固定到该版本
|
|
40
40
|
opencode plugin add opencode-search-plugin
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -52,7 +52,7 @@ opencode plugin add opencode-search-plugin
|
|
|
52
52
|
### 2. 从 GitHub 安装
|
|
53
53
|
|
|
54
54
|
```sh
|
|
55
|
-
# 追加 #v3.
|
|
55
|
+
# 追加 #v3.1.0 可固定到该 tag
|
|
56
56
|
opencode plugin add github:guotree/opencode-search-plugin
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -134,7 +134,7 @@ opencode plugin update github:guotree/opencode-search-plugin
|
|
|
134
134
|
opencode plugin update
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
升级目标用的是配置时的说明符:npm 安装用包名,GitHub 安装只认自己的 `github:` 形式,用裸包名会报 `Plugin is not configured`。先跑 `opencode plugin check` 查看有哪些过期。未固定版本的安装会跟上新版本;固定过的会停在原地(npm 形式是 `@3.
|
|
137
|
+
升级目标用的是配置时的说明符:npm 安装用包名,GitHub 安装只认自己的 `github:` 形式,用裸包名会报 `Plugin is not configured`。先跑 `opencode plugin check` 查看有哪些过期。未固定版本的安装会跟上新版本;固定过的会停在原地(npm 形式是 `@3.1.0`,GitHub 形式是 `#v3.1.0`),直到你用新 pin 重新执行 `plugin add`,或直接修改 `opencode.json(c)` 里的说明符。本地复制的文件用新版本覆盖旧文件即可。
|
|
138
138
|
|
|
139
139
|
## 卸载
|
|
140
140
|
|
|
@@ -178,7 +178,7 @@ AnySearch 和 Keenable 是例外。两家都有匿名层级,因此始终注册
|
|
|
178
178
|
| --- | --- | --- | --- | --- |
|
|
179
179
|
| AnySearch | `osp-anysearch` | `OSP_ANYSEARCH_API_KEY` | 是 | 按 IP 的免费额度;意图路由,`cn` / `intl` 分区 |
|
|
180
180
|
| Bocha | `osp-bocha` | `OSP_BOCHA_API_KEY` | 否 | 结果格式兼容 Bing;按搜索次数计费,要求摘要时另按 token 计费 |
|
|
181
|
-
| Brave Search | `osp-brave` | `
|
|
181
|
+
| Brave Search | `osp-brave` | `OSP_BRAVE_API_KEY` | 否 | 独立索引,最多 20 条结果 |
|
|
182
182
|
| DeepSeek | `osp-deepseek` | `OSP_DEEPSEEK_API_KEY` | 否 | 自研搜索引擎;每千次成功请求 5 元;限速 5 QPS |
|
|
183
183
|
| Jina | `osp-jina` | `OSP_JINA_API_KEY` | 否 | 页面正文按 token 计费,因此默认不取 |
|
|
184
184
|
| Keenable | `osp-keenable` | `OSP_KEENABLE_API_KEY` | 是 | 有 key 每月 100,000 次免费请求;无 key 层级按 IP 限速 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-search-plugin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Thirteen self-contained websearch provider plugins for OpenCode v2: AnySearch, Bocha, Brave, DeepSeek, Jina, Keenable, Linkup, Metaso, Ollama, Querit, SerpApi, Serper and You.com.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/plugins/brave-search.ts
CHANGED
|
@@ -116,7 +116,7 @@ type SearchResult = ReturnType<typeof toResult>
|
|
|
116
116
|
// "YYYY-MM-DDtoYYYY-MM-DD" range
|
|
117
117
|
// BRAVE_TIMEOUT ms to wait for Brave before failing (0 removes the
|
|
118
118
|
// deadline; cancellation still applies)
|
|
119
|
-
//
|
|
119
|
+
// OSP_BRAVE_API_KEY required; from https://brave.com/search/api/
|
|
120
120
|
const CACHE_TTL = envInt("BRAVE_CACHE_TTL", 600_000)
|
|
121
121
|
const SEARCH_SIZE = Math.min(Math.max(envInt("BRAVE_NUM", 8), 1), 20)
|
|
122
122
|
const COUNTRY = envStr("BRAVE_COUNTRY")
|
|
@@ -169,7 +169,7 @@ export const effect = (ctx: Plugin.Context) =>
|
|
|
169
169
|
})
|
|
170
170
|
editor.method.update({
|
|
171
171
|
integrationID: ID,
|
|
172
|
-
method: { type: "env", names: ["
|
|
172
|
+
method: { type: "env", names: ["OSP_BRAVE_API_KEY"] },
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
|
|
@@ -189,7 +189,7 @@ export const effect = (ctx: Plugin.Context) =>
|
|
|
189
189
|
const credential = connection
|
|
190
190
|
? yield* soften(ctx.integration.connection.resolve(connection))
|
|
191
191
|
: undefined
|
|
192
|
-
return credential?.type === "key" ? credential.key : process.env.
|
|
192
|
+
return credential?.type === "key" ? credential.key : process.env.OSP_BRAVE_API_KEY
|
|
193
193
|
})
|
|
194
194
|
|
|
195
195
|
// Brave is bound to websearch only while a key exists. Deleting the key
|
|
@@ -213,7 +213,7 @@ export const effect = (ctx: Plugin.Context) =>
|
|
|
213
213
|
const key = yield* resolveKey()
|
|
214
214
|
if (!key) {
|
|
215
215
|
return yield* Effect.fail(
|
|
216
|
-
new Error("Connect Brave in /connect, or set
|
|
216
|
+
new Error("Connect Brave in /connect, or set OSP_BRAVE_API_KEY"),
|
|
217
217
|
)
|
|
218
218
|
}
|
|
219
219
|
|