opencode-search 1.0.0-next.1 → 1.0.0-next.10
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 +39 -24
- package/REMOVED.md +13 -3
- package/dist/package.json +18 -20
- package/dist/search.js +1 -1
- package/dist/src/providers/gnews-search.d.ts +1 -1
- package/dist/src/providers/gnews-search.d.ts.map +1 -1
- package/dist/src/providers/gnews-search.js +5 -3
- package/dist/src/providers/gnews-search.js.map +1 -1
- package/dist/src/providers/rfc-search.d.ts +9 -0
- package/dist/src/providers/rfc-search.d.ts.map +1 -0
- package/dist/src/providers/rfc-search.js +38 -0
- package/dist/src/providers/rfc-search.js.map +1 -0
- package/dist/src/providers/w3c-search.d.ts +6 -0
- package/dist/src/providers/w3c-search.d.ts.map +1 -0
- package/dist/src/providers/w3c-search.js +42 -0
- package/dist/src/providers/w3c-search.js.map +1 -0
- package/dist/src/providers/whatwg-search.d.ts +8 -0
- package/dist/src/providers/whatwg-search.d.ts.map +1 -0
- package/dist/src/providers/whatwg-search.js +31 -0
- package/dist/src/providers/whatwg-search.js.map +1 -0
- package/dist/src/renderers.d.ts +6 -2
- package/dist/src/renderers.d.ts.map +1 -1
- package/dist/src/renderers.js +14 -8
- package/dist/src/renderers.js.map +1 -1
- package/dist/src/search.d.ts +3 -1
- package/dist/src/search.d.ts.map +1 -1
- package/dist/src/search.js +123 -61
- package/dist/src/search.js.map +1 -1
- package/package.json +18 -20
- package/search.ts +22 -0
- package/src/cache.test.ts +14 -0
- package/src/cache.ts +61 -0
- package/src/format.test.ts +175 -0
- package/src/format.ts +72 -0
- package/src/html.ts +39 -0
- package/src/normalize-blurb.test.ts +67 -0
- package/src/normalize-blurb.ts +22 -0
- package/src/opencode/notify.ts +16 -0
- package/src/parse-results.test.ts +75 -0
- package/src/parse-results.ts +22 -0
- package/src/providers/brave-search.ts +39 -0
- package/src/providers/bsky-search.test.ts +16 -0
- package/src/providers/bsky-search.ts +88 -0
- package/src/providers/ddg-search.test.ts +15 -0
- package/src/providers/ddg-search.ts +117 -0
- package/src/providers/gnews-search.ts +72 -0
- package/src/providers/mdn-search.test.ts +17 -0
- package/src/providers/mdn-search.ts +83 -0
- package/src/providers/rfc-search.test.ts +31 -0
- package/src/providers/rfc-search.ts +61 -0
- package/src/providers/w3c-search.test.ts +22 -0
- package/src/providers/w3c-search.ts +67 -0
- package/src/providers/whatwg-search.test.ts +21 -0
- package/src/providers/whatwg-search.ts +55 -0
- package/src/providers/wiki-search.test.ts +16 -0
- package/src/providers/wiki-search.ts +72 -0
- package/src/renderers.test.ts +263 -0
- package/src/renderers.ts +62 -0
- package/src/safe.test.ts +87 -0
- package/src/safe.ts +27 -0
- package/src/search.ts +369 -0
- package/src/strategies.test.ts +92 -0
- package/src/strategies.ts +62 -0
- package/src/user-agent.ts +3 -0
- package/src/v1-message.test.ts +17 -0
- package/src/v1-message.ts +10 -0
- package/dist/src/providers/standard-search.d.ts +0 -18
- package/dist/src/providers/standard-search.d.ts.map +0 -1
- package/dist/src/providers/standard-search.js +0 -61
- package/dist/src/providers/standard-search.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# opencode-search
|
|
2
2
|
|
|
3
|
-
An [OpenCode](https://opencode.ai) plugin that gives your agent access to DuckDuckGo, Brave, Google News, Wikipedia, Bluesky,
|
|
3
|
+
An [OpenCode](https://opencode.ai) plugin that gives your agent access to DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, MDN Web Docs, and the IETF, W3C and WHATWG specifications.
|
|
4
4
|
|
|
5
|
-
<img width="
|
|
5
|
+
<img width="776" height="393" alt="image" src="https://github.com/user-attachments/assets/7b9c0776-94a9-4184-9541-1f3bf8d9bcaa" />
|
|
6
6
|
|
|
7
7
|
## What this adds over OpenCode's built-in tools
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Nine search tools that work without an API key. OpenCode 1 has no web search at all unless you use its own provider, and OpenCode 2's requires a key for Exa, Firecrawl, Parallel or Tavily.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Seven of the tools search sources a general web search does not reach: Bluesky posts through the AT Protocol, Wikipedia and MDN through their own APIs, Google News for what is being published now, and the IETF, W3C and WHATWG specification indexes directly.
|
|
12
12
|
|
|
13
13
|
**Use at your own risk:** the DuckDuckGo and Brave providers scrape HTML nobody promised would stay parseable, so they can break without warning and may run against a service's terms. Results are unverified input.
|
|
14
14
|
|
|
15
|
-
Google web search and
|
|
15
|
+
Google web search, Mojeek and standard.site were removed — see [REMOVED.md](REMOVED.md) for what was tested and why.
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
@@ -40,7 +40,7 @@ Restart OpenCode. The plugin will be installed automatically.
|
|
|
40
40
|
|
|
41
41
|
## Tools
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### ddg_search
|
|
44
44
|
|
|
45
45
|
Search the web using DuckDuckGo. Returns structured results with title, URL, and snippet.
|
|
46
46
|
|
|
@@ -51,7 +51,7 @@ Search the web using DuckDuckGo. Returns structured results with title, URL, and
|
|
|
51
51
|
Uses DuckDuckGo's HTML endpoint with POST form parameters to avoid CAPTCHAs.
|
|
52
52
|
Results are parsed from the HTML response into structured title/URL/abstract triples.
|
|
53
53
|
|
|
54
|
-
###
|
|
54
|
+
### brave_search
|
|
55
55
|
|
|
56
56
|
Search the web using Brave Search. Returns structured results with title, URL, and snippet.
|
|
57
57
|
|
|
@@ -61,7 +61,7 @@ Search the web using Brave Search. Returns structured results with title, URL, a
|
|
|
61
61
|
|
|
62
62
|
Brave serves server-rendered HTML, so it is the most reliable general web provider here.
|
|
63
63
|
|
|
64
|
-
###
|
|
64
|
+
### gnews_search
|
|
65
65
|
|
|
66
66
|
Search Google News for recent articles. Returns headline, publisher, and publication date.
|
|
67
67
|
|
|
@@ -71,7 +71,7 @@ Search Google News for recent articles. Returns headline, publisher, and publica
|
|
|
71
71
|
|
|
72
72
|
**News and tech media only — not general web search, and not documentation.** It queries the Google News RSS feed, which is a different service from Google web search and still answers plain HTTP requests. Links are `news.google.com` redirect URLs rather than publisher URLs; they resolve only in a browser, so they are reported as-is.
|
|
73
73
|
|
|
74
|
-
###
|
|
74
|
+
### bsky_search
|
|
75
75
|
|
|
76
76
|
Search Bluesky posts via the AT Protocol. Returns posts with author handle, text, and engagement counts (likes, reposts, replies).
|
|
77
77
|
|
|
@@ -81,39 +81,54 @@ Search Bluesky posts via the AT Protocol. Returns posts with author handle, text
|
|
|
81
81
|
| `limit` | number | no | Number of results to return |
|
|
82
82
|
| `sort` | string | no | Sort order: `top` or `latest` |
|
|
83
83
|
|
|
84
|
-
###
|
|
84
|
+
### wiki_search
|
|
85
85
|
|
|
86
|
-
Search
|
|
86
|
+
Search Wikipedia articles using the MediaWiki REST API. Returns structured results with title, description, excerpt, and a direct link to the article. No API key required.
|
|
87
87
|
|
|
88
88
|
| Parameter | Type | Required | Description |
|
|
89
89
|
| --------- | ------ | -------- | ---------------------------------- |
|
|
90
90
|
| `query` | string | yes | |
|
|
91
|
-
| `limit` | number | no | Number of results
|
|
92
|
-
| `offset` | number | no | Number of results to skip |
|
|
91
|
+
| `limit` | number | no | Number of results (1-100) |
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
### mdn_search
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
Search MDN Web Docs. Returns documentation pages for web technologies with title, URL, and summary. No API key required.
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
| Parameter | Type | Required | Description |
|
|
98
|
+
| --------- | ------ | -------- | ---------------------------------- |
|
|
99
|
+
| `query` | string | yes | |
|
|
100
|
+
| `limit` | number | no | Number of results to return |
|
|
101
|
+
| `page` | number | no | Page number for pagination |
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
### rfc_search
|
|
104
|
+
|
|
105
|
+
Search IETF RFCs by title via the [Datatracker API](https://datatracker.ietf.org/api/). Returns RFC number, title, date, and abstract. No API key required.
|
|
101
106
|
|
|
102
107
|
| Parameter | Type | Required | Description |
|
|
103
108
|
| --------- | ------ | -------- | ---------------------------------- |
|
|
104
109
|
| `query` | string | yes | |
|
|
105
|
-
| `limit` | number | no | Number of results (
|
|
110
|
+
| `limit` | number | no | Number of results (default 20) |
|
|
106
111
|
|
|
107
|
-
|
|
112
|
+
Matches on title only, so a query is a phrase from the RFC's name rather than its body.
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
### w3c_search
|
|
115
|
+
|
|
116
|
+
Search W3C specifications by title via the [W3C API](https://api.w3.org/). Returns the spec title and URL. No API key required.
|
|
110
117
|
|
|
111
118
|
| Parameter | Type | Required | Description |
|
|
112
119
|
| --------- | ------ | -------- | ---------------------------------- |
|
|
113
120
|
| `query` | string | yes | |
|
|
114
|
-
| `limit` | number | no | Number of results
|
|
115
|
-
|
|
121
|
+
| `limit` | number | no | Number of results (default 20) |
|
|
122
|
+
|
|
123
|
+
The W3C API accepts a `q` parameter and ignores it — a real query and a nonsense string both return all 1713 specifications. So the full index is fetched, two pages of 1000, and filtered here. Titles only; the API exposes no abstracts.
|
|
116
124
|
|
|
117
|
-
|
|
125
|
+
### whatwg_search
|
|
126
|
+
|
|
127
|
+
Search WHATWG living standards. Returns the standard name, URL, and description. No API key required.
|
|
128
|
+
|
|
129
|
+
| Parameter | Type | Required | Description |
|
|
130
|
+
| --------- | ------ | -------- | ---------------------------------- |
|
|
131
|
+
| `query` | string | yes | |
|
|
132
|
+
| `limit` | number | no | Number of results (default 20) |
|
|
118
133
|
|
|
119
|
-
|
|
134
|
+
WHATWG publishes its whole index as one small JSON file and offers no search endpoint, so matching happens here across names and descriptions. There are only 27 standards, so expect few results.
|
package/REMOVED.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Removed providers
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## ggl_search — Google web search
|
|
4
4
|
|
|
5
5
|
Google returns no results to a non-browser client. Since 2025 it requires JavaScript for `/search`: a plain HTTP request gets a redirect stub pointing at `/httpservice/retry/enablejs`, with no results and no inline data in the body. A DOM parser or JS runtime does not help, because the results were never in the response. Legacy and text-browser user agents get a different wall, an "Update your browser" page.
|
|
6
6
|
|
|
@@ -16,9 +16,19 @@ The gate is applied before the page is built, so TLS fingerprinting is not the v
|
|
|
16
16
|
|
|
17
17
|
[`googler`](https://github.com/jarun/googler) was archived in 2021, [`googlesearch-python`](https://github.com/Nv7-GitHub/googlesearch) has no commits since 2025-02 and an issue titled "google stop Lynx support" (2025-09), and `yagooglesearch` stopped in 2024.
|
|
18
18
|
|
|
19
|
-
Use `
|
|
19
|
+
Use `brave_search` or `ddg_search` instead, or `gnews_search` for news — Google News RSS is a separate service and still answers plain HTTP.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## standard_search — standard.site
|
|
22
|
+
|
|
23
|
+
The appview this tool queried, `standard-search.octet-stream.net`, no longer resolves. Checked 2026-09-19: no DNS record at all, so the host is gone rather than temporarily down.
|
|
24
|
+
|
|
25
|
+
standard.site itself is alive and answers on `/`, but publishes no replacement search endpoint. `/docs` returns 200 and mentions none; `/api`, `/about` and `/developers` are 404.
|
|
26
|
+
|
|
27
|
+
The provider had been kept in place with its live test soft-skipping while the host was unreachable. With the DNS record gone and nothing documented to point at, there is no endpoint to restore it to.
|
|
28
|
+
|
|
29
|
+
Worth revisiting if standard.site publishes an appview again — the AT Protocol records it searched are structured and directly queryable, which no general web search substitutes for.
|
|
30
|
+
|
|
31
|
+
## mojeek_search — Mojeek
|
|
22
32
|
|
|
23
33
|
Mojeek's [robots.txt](https://www.mojeek.com/robots.txt) is `Disallow: /search` for all user agents, and their [terms](https://www.mojeek.com/about/terms.html) prohibit automated access except by "an authorised Mojeek API user", stating that "scraping the Services without Our prior consent is expressly prohibited".
|
|
24
34
|
|
package/dist/package.json
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-search",
|
|
3
|
-
"version": "1.0.0-next.
|
|
4
|
-
"description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky,
|
|
3
|
+
"version": "1.0.0-next.10",
|
|
4
|
+
"description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, MDN Web Docs, and the IETF, W3C and WHATWG specifications.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"atproto",
|
|
7
|
+
"bluesky",
|
|
8
|
+
"brave",
|
|
9
|
+
"duckduckgo",
|
|
10
|
+
"google-news",
|
|
11
|
+
"ietf",
|
|
12
|
+
"mdn",
|
|
6
13
|
"opencode",
|
|
7
14
|
"opencode-plugin",
|
|
8
15
|
"plugin",
|
|
16
|
+
"rfc",
|
|
9
17
|
"search",
|
|
18
|
+
"specifications",
|
|
19
|
+
"w3c",
|
|
10
20
|
"web-search",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"google-news",
|
|
14
|
-
"wikipedia",
|
|
15
|
-
"mdn",
|
|
16
|
-
"bluesky",
|
|
17
|
-
"atproto",
|
|
18
|
-
"standard-site"
|
|
21
|
+
"whatwg",
|
|
22
|
+
"wikipedia"
|
|
19
23
|
],
|
|
20
24
|
"homepage": "https://github.com/whaaaley/opencode-search#readme",
|
|
21
25
|
"bugs": {
|
|
@@ -38,6 +42,8 @@
|
|
|
38
42
|
"types": "./dist/search.d.ts",
|
|
39
43
|
"files": [
|
|
40
44
|
"dist/",
|
|
45
|
+
"src/",
|
|
46
|
+
"search.ts",
|
|
41
47
|
"README.md",
|
|
42
48
|
"REMOVED.md",
|
|
43
49
|
"LICENSE"
|
|
@@ -45,26 +51,18 @@
|
|
|
45
51
|
"scripts": {
|
|
46
52
|
"build": "npm run clean && tsc",
|
|
47
53
|
"clean": "rm -rf dist",
|
|
48
|
-
"
|
|
54
|
+
"prepare": "npm run build",
|
|
49
55
|
"test": "bun test",
|
|
50
56
|
"typecheck": "tsc --noEmit"
|
|
51
57
|
},
|
|
52
58
|
"dependencies": {
|
|
59
|
+
"@opencode/plugin": "2.0.10",
|
|
53
60
|
"jsdom": "26.1.0",
|
|
54
61
|
"zod": "4.1.8"
|
|
55
62
|
},
|
|
56
63
|
"devDependencies": {
|
|
57
|
-
"@opencode/plugin": "2.0.10",
|
|
58
64
|
"@types/bun": "1.3.9",
|
|
59
65
|
"@types/jsdom": "27.0.0",
|
|
60
66
|
"typescript": "5.9.3"
|
|
61
|
-
},
|
|
62
|
-
"peerDependencies": {
|
|
63
|
-
"@opencode/plugin": ">=2.0.0"
|
|
64
|
-
},
|
|
65
|
-
"peerDependenciesMeta": {
|
|
66
|
-
"@opencode/plugin": {
|
|
67
|
-
"optional": true
|
|
68
|
-
}
|
|
69
67
|
}
|
|
70
68
|
}
|
package/dist/search.js
CHANGED
|
@@ -8,7 +8,7 @@ if (error || typeof plugin.Plugin?.define !== 'function') {
|
|
|
8
8
|
throw new Error(V1_MESSAGE, { cause: error ?? new Error('Plugin.define is not exported') });
|
|
9
9
|
}
|
|
10
10
|
export default plugin.Plugin.define({
|
|
11
|
-
id: '
|
|
11
|
+
id: 'opencode-search',
|
|
12
12
|
setup: async (ctx) => {
|
|
13
13
|
await ctx.tool.transform((tools) => {
|
|
14
14
|
for (const definition of createSearchTools(ctx)) {
|
|
@@ -5,5 +5,5 @@ export type GnewsResult = {
|
|
|
5
5
|
source: string;
|
|
6
6
|
date: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const gnewsSearch: (query: string) => Promise<GnewsResult[]>;
|
|
8
|
+
export declare const gnewsSearch: (query: string, limit?: number) => Promise<GnewsResult[]>;
|
|
9
9
|
//# sourceMappingURL=gnews-search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gnews-search.d.ts","sourceRoot":"","sources":["../../../src/providers/gnews-search.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;
|
|
1
|
+
{"version":3,"file":"gnews-search.d.ts","sourceRoot":"","sources":["../../../src/providers/gnews-search.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAwBD,eAAO,MAAM,WAAW,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,WAAW,EAAE,CAmC7F,CAAA"}
|
|
@@ -16,11 +16,13 @@ const stripSource = (title, source) => {
|
|
|
16
16
|
const suffix = ' - ' + source;
|
|
17
17
|
return title.endsWith(suffix) ? title.slice(0, -suffix.length) : title;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
// The feed always returns about 100 items, which is ~10k tokens of context for one call.
|
|
20
|
+
const DEFAULT_LIMIT = 20;
|
|
21
|
+
export const gnewsSearch = async (query, limit = DEFAULT_LIMIT) => {
|
|
20
22
|
const cacheKey = 'gnews:' + query;
|
|
21
23
|
const cached = await cache.get(cacheKey);
|
|
22
24
|
if (cached)
|
|
23
|
-
return cached;
|
|
25
|
+
return cached.slice(0, limit);
|
|
24
26
|
const params = new URLSearchParams({ q: query, hl: 'en-US', gl: 'US', ceid: 'US:en' });
|
|
25
27
|
const res = await fetch(GNEWS_URL + '?' + params, { headers: baseHeaders('') });
|
|
26
28
|
if (!res.ok)
|
|
@@ -43,6 +45,6 @@ export const gnewsSearch = async (query) => {
|
|
|
43
45
|
results.push({ title, url, abstract: '', source, date: tag('pubDate') });
|
|
44
46
|
}
|
|
45
47
|
await cache.set(cacheKey, results);
|
|
46
|
-
return results;
|
|
48
|
+
return results.slice(0, limit);
|
|
47
49
|
};
|
|
48
50
|
//# sourceMappingURL=gnews-search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gnews-search.js","sourceRoot":"","sources":["../../../src/providers/gnews-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,+FAA+F;AAC/F,MAAM,SAAS,GAAG,oCAAoC,CAAA;AAUtD,MAAM,QAAQ,GAA2B;IACvC,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;CACb,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,CAChD,KAAK,CAAC,OAAO,CAAC,gCAAgC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CACrF,CAAA;AAED,mGAAmG;AACnG,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,MAAc,EAAU,EAAE;IAC5D,MAAM,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;IAC7B,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AACxE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,KAAa,EAA0B,EAAE;
|
|
1
|
+
{"version":3,"file":"gnews-search.js","sourceRoot":"","sources":["../../../src/providers/gnews-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,+FAA+F;AAC/F,MAAM,SAAS,GAAG,oCAAoC,CAAA;AAUtD,MAAM,QAAQ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,EAAE,CAAC,CAAA;IAC5F,CAAC;IAED,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rfc-search.d.ts","sourceRoot":"","sources":["../../../src/providers/rfc-search.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AASD,eAAO,MAAM,SAAS,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,SAAS,EAAE,CAwCzF,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as cache from "../cache.js";
|
|
2
|
+
const DATATRACKER_URL = 'https://datatracker.ietf.org/api/v1/doc/document/';
|
|
3
|
+
const DEFAULT_LIMIT = 20;
|
|
4
|
+
export const rfcSearch = async (query, limit = DEFAULT_LIMIT) => {
|
|
5
|
+
const cacheKey = 'rfc:' + query;
|
|
6
|
+
const cached = await cache.get(cacheKey);
|
|
7
|
+
if (cached)
|
|
8
|
+
return cached.slice(0, limit);
|
|
9
|
+
// A bare number or an 'RFC 9421' style query is a lookup, not a title search.
|
|
10
|
+
// Matches an optional 'rfc' prefix, optional space, then the digits.
|
|
11
|
+
const [, number] = query.trim().match(/^rfc[\s-]?(\d{1,5})$/i) ?? query.trim().match(/^(\d{1,5})$/) ?? [];
|
|
12
|
+
const params = new URLSearchParams({
|
|
13
|
+
...(number ? { name: 'rfc' + number } : { title__icontains: query }),
|
|
14
|
+
type: 'rfc',
|
|
15
|
+
limit: String(Math.min(limit, 100)),
|
|
16
|
+
format: 'json',
|
|
17
|
+
});
|
|
18
|
+
const res = await fetch(DATATRACKER_URL + '?' + params);
|
|
19
|
+
if (!res.ok)
|
|
20
|
+
throw new Error('IETF Datatracker returned ' + res.status + ' ' + res.statusText);
|
|
21
|
+
const body = await res.json();
|
|
22
|
+
const results = [];
|
|
23
|
+
for (const doc of body.objects ?? []) {
|
|
24
|
+
const id = doc.name ?? '';
|
|
25
|
+
if (!id)
|
|
26
|
+
continue;
|
|
27
|
+
results.push({
|
|
28
|
+
id: id.toUpperCase(),
|
|
29
|
+
title: doc.title ?? '',
|
|
30
|
+
url: 'https://www.rfc-editor.org/rfc/' + id + '.html',
|
|
31
|
+
date: doc.time ?? '',
|
|
32
|
+
abstract: doc.abstract ?? '',
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
await cache.set(cacheKey, results);
|
|
36
|
+
return results.slice(0, limit);
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=rfc-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rfc-search.js","sourceRoot":"","sources":["../../../src/providers/rfc-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,MAAM,eAAe,GAAG,mDAAmD,CAAA;AAC3E,MAAM,aAAa,GAAG,EAAE,CAAA;AAiBxB,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,KAAa,EAAE,KAAK,GAAG,aAAa,EAAwB,EAAE;IAC5F,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;IAE/B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAc,QAAQ,CAAC,CAAA;IACrD,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAEzC,8EAA8E;IAC9E,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,C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C;IAED,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"w3c-search.d.ts","sourceRoot":"","sources":["../../../src/providers/w3c-search.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAsBD,eAAO,MAAM,SAAS,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,SAAS,EAAE,CAgCzF,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as cache from "../cache.js";
|
|
2
|
+
// The W3C API accepts a `q` parameter and ignores it: 'css' and a nonsense string both return all
|
|
3
|
+
// 1713 specifications.
|
|
4
|
+
// So the whole list is fetched and filtered here, 1000 per page.
|
|
5
|
+
const API_URL = 'https://api.w3.org/specifications';
|
|
6
|
+
const PAGE_SIZE = 1000;
|
|
7
|
+
const DEFAULT_LIMIT = 20;
|
|
8
|
+
const fetchPage = async (page) => {
|
|
9
|
+
const params = new URLSearchParams({ items: String(PAGE_SIZE), page: String(page) });
|
|
10
|
+
const res = await fetch(API_URL + '?' + params);
|
|
11
|
+
if (!res.ok)
|
|
12
|
+
throw new Error('W3C API returned ' + res.status + ' ' + res.statusText);
|
|
13
|
+
return await res.json();
|
|
14
|
+
};
|
|
15
|
+
export const w3cSearch = async (query, limit = DEFAULT_LIMIT) => {
|
|
16
|
+
const cacheKey = 'w3c:' + query;
|
|
17
|
+
const cached = await cache.get(cacheKey);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached.slice(0, limit);
|
|
20
|
+
const first = await fetchPage(1);
|
|
21
|
+
const specs = [...first._links?.specifications ?? []];
|
|
22
|
+
// `pages` counts pages at the requested size, so a second fetch covers the rest at 1000 each.
|
|
23
|
+
const total = first.pages ?? 1;
|
|
24
|
+
for (let page = 2; page <= total; page++) {
|
|
25
|
+
const next = await fetchPage(page);
|
|
26
|
+
specs.push(...next._links?.specifications ?? []);
|
|
27
|
+
}
|
|
28
|
+
const needle = query.toLowerCase();
|
|
29
|
+
const results = [];
|
|
30
|
+
for (const spec of specs) {
|
|
31
|
+
const title = spec.title ?? '';
|
|
32
|
+
const url = spec.shortlink ?? spec.href ?? '';
|
|
33
|
+
if (!title || !url)
|
|
34
|
+
continue;
|
|
35
|
+
if (!title.toLowerCase().includes(needle))
|
|
36
|
+
continue;
|
|
37
|
+
results.push({ title, url });
|
|
38
|
+
}
|
|
39
|
+
await cache.set(cacheKey, results);
|
|
40
|
+
return results.slice(0, limit);
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=w3c-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"w3c-search.js","sourceRoot":"","sources":["../../../src/providers/w3c-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,kGAAkG;AAClG,uBAAuB;AACvB,iEAAiE;AACjE,MAAM,OAAO,GAAG,mCAAmC,CAAA;AACnD,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,aAAa,GAAG,EAAE,CAAA;AAkBxB,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAiB,EAAE;IACtD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,GAAG,GAAG,GAAG,MAAM,CAAC,CAAA;IAE/C,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,GAAG,CAAC,M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E,SAAQ;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,SAAQ;QAEnD,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatwg-search.d.ts","sourceRoot":"","sources":["../../../src/providers/whatwg-search.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAaD,eAAO,MAAM,YAAY,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,YAAY,EAAE,CA8B/F,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as cache from "../cache.js";
|
|
2
|
+
// WHATWG publishes its whole standards index as one small JSON file, and offers no search endpoint.
|
|
3
|
+
const DB_URL = 'https://raw.githubusercontent.com/whatwg/sg/main/db.json';
|
|
4
|
+
const DEFAULT_LIMIT = 20;
|
|
5
|
+
export const whatwgSearch = async (query, limit = DEFAULT_LIMIT) => {
|
|
6
|
+
const cacheKey = 'whatwg:' + query;
|
|
7
|
+
const cached = await cache.get(cacheKey);
|
|
8
|
+
if (cached)
|
|
9
|
+
return cached.slice(0, limit);
|
|
10
|
+
const res = await fetch(DB_URL);
|
|
11
|
+
if (!res.ok)
|
|
12
|
+
throw new Error('WHATWG index returned ' + res.status + ' ' + res.statusText);
|
|
13
|
+
const body = await res.json();
|
|
14
|
+
const needle = query.toLowerCase();
|
|
15
|
+
const results = [];
|
|
16
|
+
for (const workstream of body.workstreams ?? []) {
|
|
17
|
+
for (const standard of workstream.standards ?? []) {
|
|
18
|
+
const title = standard.name ?? '';
|
|
19
|
+
const url = standard.href ?? '';
|
|
20
|
+
const abstract = standard.description ?? '';
|
|
21
|
+
if (!title || !url)
|
|
22
|
+
continue;
|
|
23
|
+
if (!(title + ' ' + abstract).toLowerCase().includes(needle))
|
|
24
|
+
continue;
|
|
25
|
+
results.push({ title, url, abstract, workstream: workstream.name ?? '' });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
await cache.set(cacheKey, results);
|
|
29
|
+
return results.slice(0, limit);
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=whatwg-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatwg-search.js","sourceRoot":"","sources":["../../../src/providers/whatwg-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,oGAAoG;AACpG,MAAM,MAAM,GAAG,0DAA0D,CAAA;AACzE,MAAM,aAAa,GAAG,EAAE,CAAA;AAoBxB,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,KAAa,EAAE,KAAK,GAAG,aAAa,EAA2B,EAAE;IAClG,MAAM,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAA;IAElC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAiB,QAAQ,CAAC,CAAA;IACxD,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAEzC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,CAAA;IAE/B,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAA;IAE1F,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAoC,CAAA;IAC/D,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;IAClC,MAAM,OAAO,GAAmB,EAAE,CAAA;IAElC,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE,CAAC;QAChD,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;YAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAA;YACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAA;YAC/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAA;YAE3C,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG;gBAAE,SAAQ;YAC5B,IAAI,CAAC,CAAC,KAAK,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,SAAQ;YAEtE,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAA;QAC3E,CAAC;IACH,CAAC;IAED,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
|
package/dist/src/renderers.d.ts
CHANGED
|
@@ -2,13 +2,17 @@ import type { BskyPost } from './providers/bsky-search.ts';
|
|
|
2
2
|
import type { DdgResult } from './providers/ddg-search.ts';
|
|
3
3
|
import type { GnewsResult } from './providers/gnews-search.ts';
|
|
4
4
|
import type { MdnDocument } from './providers/mdn-search.ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type { RfcResult } from './providers/rfc-search.ts';
|
|
6
|
+
import type { W3cResult } from './providers/w3c-search.ts';
|
|
7
|
+
import type { WhatwgResult } from './providers/whatwg-search.ts';
|
|
6
8
|
import type { WikiPage } from './providers/wiki-search.ts';
|
|
7
9
|
export declare const renderDdgResult: (result: DdgResult, index: number) => string;
|
|
8
10
|
export declare const renderWebResult: (result: DdgResult, index: number) => string;
|
|
9
11
|
export declare const renderGnewsItem: (result: GnewsResult, index: number) => string;
|
|
10
12
|
export declare const renderBskyPost: (post: BskyPost, index: number) => string;
|
|
11
|
-
export declare const renderStandardDoc: (doc: StandardDocument, index: number) => string;
|
|
12
13
|
export declare const renderWikiPage: (page: WikiPage, index: number) => string;
|
|
13
14
|
export declare const renderMdnDoc: (doc: MdnDocument, index: number) => string;
|
|
15
|
+
export declare const renderRfc: (result: RfcResult, index: number) => string;
|
|
16
|
+
export declare const renderW3c: (result: W3cResult, index: number) => string;
|
|
17
|
+
export declare const renderWhatwg: (result: WhatwgResult, index: number) => string;
|
|
14
18
|
//# sourceMappingURL=renderers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../src/renderers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../src/renderers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,EAAE,OAAO,MAAM,KAAG,MAIlE,CAAA;AAGD,eAAO,MAAM,eAAe,WAPY,SAAS,SAAS,MAAM,KAAG,MAOrB,CAAA;AAE9C,eAAO,MAAM,eAAe,GAAI,QAAQ,WAAW,EAAE,OAAO,MAAM,KAAG,MAIpE,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,KAAG,MAI9D,CAAA;AAGD,eAAO,MAAM,cAAc,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,KAAG,MAK9D,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,KAAK,WAAW,EAAE,OAAO,MAAM,KAAG,MAI9D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,SAAS,EAAE,OAAO,MAAM,KAAG,MAI5D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,SAAS,EAAE,OAAO,MAAM,KAAG,MAG5D,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,EAAE,OAAO,MAAM,KAAG,MAIlE,CAAA"}
|
package/dist/src/renderers.js
CHANGED
|
@@ -15,14 +15,6 @@ export const renderGnewsItem = (result, index) => {
|
|
|
15
15
|
export const renderBskyPost = (post, index) => (`${index + 1}. @${post.author.handle} (${formatDateTime(post.record.createdAt)})
|
|
16
16
|
${normalizeBlurb(post.record.text)}
|
|
17
17
|
Likes: ${post.likeCount} Reposts: ${post.repostCount} Replies: ${post.replyCount}`);
|
|
18
|
-
export const renderStandardDoc = (doc, index) => {
|
|
19
|
-
const title = doc.date
|
|
20
|
-
? `${index + 1}. ${doc.title} (${formatDate(doc.date)})`
|
|
21
|
-
: `${index + 1}. ${doc.title}`;
|
|
22
|
-
return `${title}
|
|
23
|
-
${doc.url}
|
|
24
|
-
${normalizeBlurb(doc.snippet)}`;
|
|
25
|
-
};
|
|
26
18
|
export const renderWikiPage = (page, index) => {
|
|
27
19
|
const desc = page.description ? `\n ${normalizeBlurb(page.description)}` : '';
|
|
28
20
|
return `${index + 1}. ${page.title}
|
|
@@ -34,4 +26,18 @@ export const renderMdnDoc = (doc, index) => {
|
|
|
34
26
|
https://developer.mozilla.org${doc.mdn_url}
|
|
35
27
|
${normalizeBlurb(doc.summary)}`;
|
|
36
28
|
};
|
|
29
|
+
export const renderRfc = (result, index) => {
|
|
30
|
+
return `${index + 1}. ${result.id} — ${result.title}
|
|
31
|
+
${result.url}
|
|
32
|
+
${normalizeBlurb(result.abstract)}`;
|
|
33
|
+
};
|
|
34
|
+
export const renderW3c = (result, index) => {
|
|
35
|
+
return `${index + 1}. ${result.title}
|
|
36
|
+
${result.url}`;
|
|
37
|
+
};
|
|
38
|
+
export const renderWhatwg = (result, index) => {
|
|
39
|
+
return `${index + 1}. ${result.title}
|
|
40
|
+
${result.url}
|
|
41
|
+
${normalizeBlurb(result.abstract)}`;
|
|
42
|
+
};
|
|
37
43
|
//# sourceMappingURL=renderers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../src/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../src/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,E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CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/E,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK;mCACD,IAAI,CAAC,GAAG,GAAG,IAAI;KAC7C,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAgB,EAAE,KAAa,EAAU,EAAE;IACtE,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,KAAK;kCACD,GAAG,CAAC,OAAO;KACxC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAA;AAClC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAiB,EAAE,KAAa,EAAU,EAAE;IACpE,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC,KAAK;KAChD,MAAM,CAAC,GAAG;KACV,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAiB,EAAE,KAAa,EAAU,EAAE;IACpE,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,KAAK;KACjC,MAAM,CAAC,GAAG,EAAE,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAoB,EAAE,KAAa,EAAU,EAAE;IAC1E,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,KAAK;KACjC,MAAM,CAAC,GAAG;KACV,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;AACtC,CAAC,CAAA"}
|
package/dist/src/search.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import type * as Tool from '@opencode/plugin/promise/tool';
|
|
|
3
3
|
export declare const createDdgSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
4
4
|
export declare const createBraveSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
5
5
|
export declare const createBskySearchTool: (context: Plugin.Context) => Tool.Info;
|
|
6
|
-
export declare const createStandardSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
7
6
|
export declare const createWikiSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
8
7
|
export declare const createGnewsSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
9
8
|
export declare const createMdnSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
9
|
+
export declare const createRfcSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
10
|
+
export declare const createW3cSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
11
|
+
export declare const createWhatwgSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
10
12
|
export declare const createSearchTools: (context: Plugin.Context) => Tool.Info[];
|
|
11
13
|
//# sourceMappingURL=search.d.ts.map
|
package/dist/src/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,KAAK,IAAI,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,KAAK,IAAI,MAAM,+BAA+B,CAAA;AA8D1D,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAqBjE,CAAA;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAqBnE,CAAA;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,CAAC,OAAO,KA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