opencode-search 1.0.0-next.8 → 1.0.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 +35 -6
- package/dist/package.json +14 -9
- 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 -0
- package/dist/src/renderers.d.ts.map +1 -1
- package/dist/src/renderers.js +14 -0
- package/dist/src/renderers.js.map +1 -1
- package/dist/src/search.d.ts +3 -0
- package/dist/src/search.d.ts.map +1 -1
- package/dist/src/search.js +131 -9
- package/dist/src/search.js.map +1 -1
- package/package.json +14 -9
- 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/renderers.ts +20 -0
- package/src/search.ts +145 -8
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
|
@@ -100,6 +100,35 @@ Search MDN Web Docs. Returns documentation pages for web technologies with title
|
|
|
100
100
|
| `limit` | number | no | Number of results to return |
|
|
101
101
|
| `page` | number | no | Page number for pagination |
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
### rfc_search
|
|
104
104
|
|
|
105
|
-
|
|
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.
|
|
106
|
+
|
|
107
|
+
| Parameter | Type | Required | Description |
|
|
108
|
+
| --------- | ------ | -------- | ---------------------------------- |
|
|
109
|
+
| `query` | string | yes | |
|
|
110
|
+
| `limit` | number | no | Number of results (default 20) |
|
|
111
|
+
|
|
112
|
+
Matches on title only, so a query is a phrase from the RFC's name rather than its body.
|
|
113
|
+
|
|
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.
|
|
117
|
+
|
|
118
|
+
| Parameter | Type | Required | Description |
|
|
119
|
+
| --------- | ------ | -------- | ---------------------------------- |
|
|
120
|
+
| `query` | string | yes | |
|
|
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.
|
|
124
|
+
|
|
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) |
|
|
133
|
+
|
|
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/dist/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-search",
|
|
3
|
-
"version": "1.0.0
|
|
4
|
-
"description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky,
|
|
3
|
+
"version": "1.0.0",
|
|
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"
|
|
21
|
+
"whatwg",
|
|
22
|
+
"wikipedia"
|
|
18
23
|
],
|
|
19
24
|
"homepage": "https://github.com/whaaaley/opencode-search#readme",
|
|
20
25
|
"bugs": {
|
|
@@ -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,CAAC,uBAAuB,CAAC,IAAI,KAAK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,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,MAAM,GAAG,GAAG,GAAG,GAAG,C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AAK,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,6 +2,9 @@ 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 { RfcResult } from './providers/rfc-search.ts';
|
|
6
|
+
import type { W3cResult } from './providers/w3c-search.ts';
|
|
7
|
+
import type { WhatwgResult } from './providers/whatwg-search.ts';
|
|
5
8
|
import type { WikiPage } from './providers/wiki-search.ts';
|
|
6
9
|
export declare const renderDdgResult: (result: DdgResult, index: number) => string;
|
|
7
10
|
export declare const renderWebResult: (result: DdgResult, index: number) => string;
|
|
@@ -9,4 +12,7 @@ export declare const renderGnewsItem: (result: GnewsResult, index: number) => st
|
|
|
9
12
|
export declare const renderBskyPost: (post: BskyPost, index: number) => string;
|
|
10
13
|
export declare const renderWikiPage: (page: WikiPage, index: number) => string;
|
|
11
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;
|
|
12
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,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,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AAQ,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
|
@@ -26,4 +26,18 @@ export const renderMdnDoc = (doc, index) => {
|
|
|
26
26
|
https://developer.mozilla.org${doc.mdn_url}
|
|
27
27
|
${normalizeBlurb(doc.summary)}`;
|
|
28
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
|
+
};
|
|
29
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,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAUrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAiB,EAAE,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AAC,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
|
@@ -6,5 +6,8 @@ export declare const createBskySearchTool: (context: Plugin.Context) => Tool.Inf
|
|
|
6
6
|
export declare const createWikiSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
7
7
|
export declare const createGnewsSearchTool: (context: Plugin.Context) => Tool.Info;
|
|
8
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;
|
|
9
12
|
export declare const createSearchTools: (context: Plugin.Context) => Tool.Info[];
|
|
10
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,IAyBjE,CAAA;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAyBnE,CAAA;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAyClE,CAAA;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAuClE,CAAA;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAkCnE,CAAA;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAwCjE,CAAA;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAmCjE,CAAA;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAmCjE,CAAA;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAmCpE,CAAA;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAAI,EAUpE,CAAA"}
|
package/dist/src/search.js
CHANGED
|
@@ -5,8 +5,11 @@ import { bskySearch } from "./providers/bsky-search.js";
|
|
|
5
5
|
import { ddgSearch } from "./providers/ddg-search.js";
|
|
6
6
|
import { gnewsSearch } from "./providers/gnews-search.js";
|
|
7
7
|
import { mdnSearch } from "./providers/mdn-search.js";
|
|
8
|
+
import { rfcSearch } from "./providers/rfc-search.js";
|
|
9
|
+
import { w3cSearch } from "./providers/w3c-search.js";
|
|
10
|
+
import { whatwgSearch } from "./providers/whatwg-search.js";
|
|
8
11
|
import { wikiSearch } from "./providers/wiki-search.js";
|
|
9
|
-
import { renderBskyPost, renderDdgResult, renderGnewsItem, renderMdnDoc, renderWebResult, renderWikiPage, } from "./renderers.js";
|
|
12
|
+
import { renderBskyPost, renderDdgResult, renderGnewsItem, renderMdnDoc, renderRfc, renderW3c, renderWhatwg, renderWebResult, renderWikiPage, } from "./renderers.js";
|
|
10
13
|
import { safeAsync } from "./safe.js";
|
|
11
14
|
const postResult = async (context, ctx, text) => {
|
|
12
15
|
await safeAsync(() => sendResult({ context, sessionID: ctx.sessionID, text }));
|
|
@@ -39,7 +42,11 @@ const queryArg = {
|
|
|
39
42
|
};
|
|
40
43
|
export const createDdgSearchTool = (context) => ({
|
|
41
44
|
name: 'ddg_search',
|
|
42
|
-
description:
|
|
45
|
+
description: [
|
|
46
|
+
'Search the web with DuckDuckGo when you need current information from the internet.',
|
|
47
|
+
'Use for general web queries: products, people, events, how-tos, anything not covered by a more specific tool.',
|
|
48
|
+
'Returns titles, URLs and snippets.',
|
|
49
|
+
].join(' '),
|
|
43
50
|
input: queryArg,
|
|
44
51
|
async execute(input, ctx) {
|
|
45
52
|
const query = stringField(input, 'query');
|
|
@@ -58,7 +65,11 @@ export const createDdgSearchTool = (context) => ({
|
|
|
58
65
|
});
|
|
59
66
|
export const createBraveSearchTool = (context) => ({
|
|
60
67
|
name: 'brave_search',
|
|
61
|
-
description:
|
|
68
|
+
description: [
|
|
69
|
+
'Search the web with Brave when you need current information from the internet.',
|
|
70
|
+
'The most reliable general web search here; prefer it over ddg_search when either would do.',
|
|
71
|
+
'Returns titles, URLs and snippets.',
|
|
72
|
+
].join(' '),
|
|
62
73
|
input: queryArg,
|
|
63
74
|
async execute(input, ctx) {
|
|
64
75
|
const query = stringField(input, 'query');
|
|
@@ -78,8 +89,9 @@ export const createBraveSearchTool = (context) => ({
|
|
|
78
89
|
export const createBskySearchTool = (context) => ({
|
|
79
90
|
name: 'bsky_search',
|
|
80
91
|
description: [
|
|
81
|
-
'Search Bluesky posts
|
|
82
|
-
'
|
|
92
|
+
'Search Bluesky posts for what people are saying about a topic right now.',
|
|
93
|
+
'Use for public reaction, discussion and opinion, not for documentation or reference material.',
|
|
94
|
+
'Returns author handle, post text, and like, repost and reply counts.',
|
|
83
95
|
].join(' '),
|
|
84
96
|
input: {
|
|
85
97
|
type: 'object',
|
|
@@ -112,7 +124,11 @@ export const createBskySearchTool = (context) => ({
|
|
|
112
124
|
});
|
|
113
125
|
export const createWikiSearchTool = (context) => ({
|
|
114
126
|
name: 'wiki_search',
|
|
115
|
-
description:
|
|
127
|
+
description: [
|
|
128
|
+
'Look up a subject on Wikipedia for background, definitions and general reference.',
|
|
129
|
+
'Use when the question is about what something IS rather than what is happening with it.',
|
|
130
|
+
'Returns page titles, descriptions and excerpts.',
|
|
131
|
+
].join(' '),
|
|
116
132
|
input: {
|
|
117
133
|
type: 'object',
|
|
118
134
|
properties: {
|
|
@@ -143,9 +159,9 @@ export const createWikiSearchTool = (context) => ({
|
|
|
143
159
|
export const createGnewsSearchTool = (context) => ({
|
|
144
160
|
name: 'gnews_search',
|
|
145
161
|
description: [
|
|
146
|
-
'Search Google News for recent
|
|
162
|
+
'Search Google News for recent news coverage of a topic.',
|
|
147
163
|
'News and tech media only — not general web search, and not documentation.',
|
|
148
|
-
'Links are news.google.com redirect URLs, not publisher URLs.',
|
|
164
|
+
'Links are news.google.com redirect URLs that only open in a browser, not publisher URLs.',
|
|
149
165
|
].join(' '),
|
|
150
166
|
input: {
|
|
151
167
|
type: 'object',
|
|
@@ -174,7 +190,11 @@ export const createGnewsSearchTool = (context) => ({
|
|
|
174
190
|
});
|
|
175
191
|
export const createMdnSearchTool = (context) => ({
|
|
176
192
|
name: 'mdn_search',
|
|
177
|
-
description:
|
|
193
|
+
description: [
|
|
194
|
+
'Look up web platform documentation on MDN: JavaScript, CSS, HTML, and browser APIs.',
|
|
195
|
+
'Use for how a web API behaves, its syntax, parameters or browser support.',
|
|
196
|
+
'Returns documentation pages with titles, URLs and summaries.',
|
|
197
|
+
].join(' '),
|
|
178
198
|
input: {
|
|
179
199
|
type: 'object',
|
|
180
200
|
properties: {
|
|
@@ -203,12 +223,114 @@ export const createMdnSearchTool = (context) => ({
|
|
|
203
223
|
return textOutput(formatted);
|
|
204
224
|
},
|
|
205
225
|
});
|
|
226
|
+
export const createRfcSearchTool = (context) => ({
|
|
227
|
+
name: 'rfc_search',
|
|
228
|
+
description: [
|
|
229
|
+
'Look up an IETF RFC by number or title.',
|
|
230
|
+
'Accepts a number like 9421, RFC9421 or \'rfc 9421\' for a direct lookup, or words from the title to search.',
|
|
231
|
+
'Use for internet protocol specifications: HTTP, TCP, TLS, DNS, email, and so on.',
|
|
232
|
+
'Returns the RFC number, title, date, abstract, and a link to the full text.',
|
|
233
|
+
].join(' '),
|
|
234
|
+
input: {
|
|
235
|
+
type: 'object',
|
|
236
|
+
properties: {
|
|
237
|
+
query: { type: 'string', description: "An RFC number like 9421 or 'RFC9421', or words from the title" },
|
|
238
|
+
limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
|
|
239
|
+
},
|
|
240
|
+
required: ['query'],
|
|
241
|
+
additionalProperties: false,
|
|
242
|
+
},
|
|
243
|
+
async execute(input, ctx) {
|
|
244
|
+
const query = stringField(input, 'query');
|
|
245
|
+
const limit = numberField(input, 'limit');
|
|
246
|
+
const { data, error } = await safeAsync(() => rfcSearch(query, limit));
|
|
247
|
+
if (error)
|
|
248
|
+
return textOutput('RFC search failed: ' + error.message);
|
|
249
|
+
const formatted = formatResults({
|
|
250
|
+
label: 'RFC results',
|
|
251
|
+
items: data,
|
|
252
|
+
total: data.length,
|
|
253
|
+
renderItem: renderRfc,
|
|
254
|
+
});
|
|
255
|
+
await postResult(context, ctx, formatted);
|
|
256
|
+
return textOutput(formatted);
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
export const createW3cSearchTool = (context) => ({
|
|
260
|
+
name: 'w3c_search',
|
|
261
|
+
description: [
|
|
262
|
+
'Look up a W3C specification by words in its title.',
|
|
263
|
+
'Use for web standards W3C publishes: CSS, WCAG accessibility, SVG, WebRTC, and similar.',
|
|
264
|
+
'Matches titles only, so query the spec name rather than a concept inside it.',
|
|
265
|
+
'Returns the specification title and URL.',
|
|
266
|
+
].join(' '),
|
|
267
|
+
input: {
|
|
268
|
+
type: 'object',
|
|
269
|
+
properties: {
|
|
270
|
+
query: { type: 'string', description: 'The search query' },
|
|
271
|
+
limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
|
|
272
|
+
},
|
|
273
|
+
required: ['query'],
|
|
274
|
+
additionalProperties: false,
|
|
275
|
+
},
|
|
276
|
+
async execute(input, ctx) {
|
|
277
|
+
const query = stringField(input, 'query');
|
|
278
|
+
const limit = numberField(input, 'limit');
|
|
279
|
+
const { data, error } = await safeAsync(() => w3cSearch(query, limit));
|
|
280
|
+
if (error)
|
|
281
|
+
return textOutput('W3C search failed: ' + error.message);
|
|
282
|
+
const formatted = formatResults({
|
|
283
|
+
label: 'W3C results',
|
|
284
|
+
items: data,
|
|
285
|
+
total: data.length,
|
|
286
|
+
renderItem: renderW3c,
|
|
287
|
+
});
|
|
288
|
+
await postResult(context, ctx, formatted);
|
|
289
|
+
return textOutput(formatted);
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
export const createWhatwgSearchTool = (context) => ({
|
|
293
|
+
name: 'whatwg_search',
|
|
294
|
+
description: [
|
|
295
|
+
'Look up a WHATWG living standard such as HTML, DOM, Fetch, URL or Streams.',
|
|
296
|
+
'Use for the current web platform specs WHATWG maintains, which supersede older W3C versions.',
|
|
297
|
+
'There are only 27 standards, so expect few results.',
|
|
298
|
+
'Returns the standard name, URL and description.',
|
|
299
|
+
].join(' '),
|
|
300
|
+
input: {
|
|
301
|
+
type: 'object',
|
|
302
|
+
properties: {
|
|
303
|
+
query: { type: 'string', description: 'The search query' },
|
|
304
|
+
limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
|
|
305
|
+
},
|
|
306
|
+
required: ['query'],
|
|
307
|
+
additionalProperties: false,
|
|
308
|
+
},
|
|
309
|
+
async execute(input, ctx) {
|
|
310
|
+
const query = stringField(input, 'query');
|
|
311
|
+
const limit = numberField(input, 'limit');
|
|
312
|
+
const { data, error } = await safeAsync(() => whatwgSearch(query, limit));
|
|
313
|
+
if (error)
|
|
314
|
+
return textOutput('WHATWG search failed: ' + error.message);
|
|
315
|
+
const formatted = formatResults({
|
|
316
|
+
label: 'WHATWG results',
|
|
317
|
+
items: data,
|
|
318
|
+
total: data.length,
|
|
319
|
+
renderItem: renderWhatwg,
|
|
320
|
+
});
|
|
321
|
+
await postResult(context, ctx, formatted);
|
|
322
|
+
return textOutput(formatted);
|
|
323
|
+
},
|
|
324
|
+
});
|
|
206
325
|
export const createSearchTools = (context) => [
|
|
207
326
|
createBraveSearchTool(context),
|
|
208
327
|
createBskySearchTool(context),
|
|
209
328
|
createDdgSearchTool(context),
|
|
210
329
|
createGnewsSearchTool(context),
|
|
211
330
|
createMdnSearchTool(context),
|
|
331
|
+
createRfcSearchTool(context),
|
|
332
|
+
createW3cSearchTool(context),
|
|
333
|
+
createWhatwgSearchTool(context),
|
|
212
334
|
createWikiSearchTool(context),
|
|
213
335
|
];
|
|
214
336
|
//# sourceMappingURL=search.js.map
|
package/dist/src/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EACL,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,UAAU,GAAG,KAAK,EAAE,OAAuB,EAAE,GAAqB,EAAE,IAAY,EAAE,EAAE;IACxF,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAChF,CAAC,CAAA;AAED,iGAAiG;AACjG,8BAA8B;AAC9B,MAAM,UAAU,GAAG,CAAC,IAAY,EAAe,EAAE,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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AO,CAAC;IAC7B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,qBAAqB,CAAC,OAAO,CAAC;IAC9B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,sBAAsB,CAAC,OAAO,CAAC;IAC/B,oBAAoB,CAAC,OAAO,CAAC;CAC9B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-search",
|
|
3
|
-
"version": "1.0.0
|
|
4
|
-
"description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky,
|
|
3
|
+
"version": "1.0.0",
|
|
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"
|
|
21
|
+
"whatwg",
|
|
22
|
+
"wikipedia"
|
|
18
23
|
],
|
|
19
24
|
"homepage": "https://github.com/whaaaley/opencode-search#readme",
|
|
20
25
|
"bugs": {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
import { rfcSearch } from './rfc-search.ts'
|
|
3
|
+
|
|
4
|
+
describe('rfcSearch', () => {
|
|
5
|
+
it('returns RFCs matching a title query', async () => {
|
|
6
|
+
const results = await rfcSearch('HTTP Semantics')
|
|
7
|
+
|
|
8
|
+
expect(results.length).toBeGreaterThan(0)
|
|
9
|
+
|
|
10
|
+
const first = results[0]
|
|
11
|
+
if (!first) throw new Error('Expected at least one RFC')
|
|
12
|
+
|
|
13
|
+
expect(first.id).toMatch(/^RFC\d+$/)
|
|
14
|
+
expect(first.url).toStartWith('https://www.rfc-editor.org/rfc/')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('looks up an RFC by number', async () => {
|
|
18
|
+
for (const query of ['RFC9421', 'rfc 9421', '9421']) {
|
|
19
|
+
const results = await rfcSearch(query)
|
|
20
|
+
|
|
21
|
+
expect(results.length).toEqual(1)
|
|
22
|
+
expect(results[0]?.id).toEqual('RFC9421')
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('respects the limit', async () => {
|
|
27
|
+
const results = await rfcSearch('HTTP', 3)
|
|
28
|
+
|
|
29
|
+
expect(results.length).toBeLessThanOrEqual(3)
|
|
30
|
+
})
|
|
31
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as cache from '../cache.ts'
|
|
2
|
+
|
|
3
|
+
const DATATRACKER_URL = 'https://datatracker.ietf.org/api/v1/doc/document/'
|
|
4
|
+
const DEFAULT_LIMIT = 20
|
|
5
|
+
|
|
6
|
+
export type RfcResult = {
|
|
7
|
+
id: string
|
|
8
|
+
title: string
|
|
9
|
+
url: string
|
|
10
|
+
date: string
|
|
11
|
+
abstract: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type DatatrackerDoc = {
|
|
15
|
+
name?: string
|
|
16
|
+
title?: string
|
|
17
|
+
time?: string
|
|
18
|
+
abstract?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const rfcSearch = async (query: string, limit = DEFAULT_LIMIT): Promise<RfcResult[]> => {
|
|
22
|
+
const cacheKey = 'rfc:' + query
|
|
23
|
+
|
|
24
|
+
const cached = await cache.get<RfcResult[]>(cacheKey)
|
|
25
|
+
if (cached) return cached.slice(0, limit)
|
|
26
|
+
|
|
27
|
+
// A bare number or an 'RFC 9421' style query is a lookup, not a title search.
|
|
28
|
+
// Matches an optional 'rfc' prefix, optional space, then the digits.
|
|
29
|
+
const [, number] = query.trim().match(/^rfc[\s-]?(\d{1,5})$/i) ?? query.trim().match(/^(\d{1,5})$/) ?? []
|
|
30
|
+
|
|
31
|
+
const params = new URLSearchParams({
|
|
32
|
+
...(number ? { name: 'rfc' + number } : { title__icontains: query }),
|
|
33
|
+
type: 'rfc',
|
|
34
|
+
limit: String(Math.min(limit, 100)),
|
|
35
|
+
format: 'json',
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const res = await fetch(DATATRACKER_URL + '?' + params)
|
|
39
|
+
|
|
40
|
+
if (!res.ok) throw new Error('IETF Datatracker returned ' + res.status + ' ' + res.statusText)
|
|
41
|
+
|
|
42
|
+
const body = await res.json() as { objects?: DatatrackerDoc[] }
|
|
43
|
+
const results: RfcResult[] = []
|
|
44
|
+
|
|
45
|
+
for (const doc of body.objects ?? []) {
|
|
46
|
+
const id = doc.name ?? ''
|
|
47
|
+
if (!id) continue
|
|
48
|
+
|
|
49
|
+
results.push({
|
|
50
|
+
id: id.toUpperCase(),
|
|
51
|
+
title: doc.title ?? '',
|
|
52
|
+
url: 'https://www.rfc-editor.org/rfc/' + id + '.html',
|
|
53
|
+
date: doc.time ?? '',
|
|
54
|
+
abstract: doc.abstract ?? '',
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await cache.set(cacheKey, results)
|
|
59
|
+
|
|
60
|
+
return results.slice(0, limit)
|
|
61
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
import { w3cSearch } from './w3c-search.ts'
|
|
3
|
+
|
|
4
|
+
describe('w3cSearch', () => {
|
|
5
|
+
it('filters specifications by title', async () => {
|
|
6
|
+
const results = await w3cSearch('CSS')
|
|
7
|
+
|
|
8
|
+
expect(results.length).toBeGreaterThan(0)
|
|
9
|
+
|
|
10
|
+
const first = results[0]
|
|
11
|
+
if (!first) throw new Error('Expected at least one specification')
|
|
12
|
+
|
|
13
|
+
expect(first.title.toLowerCase()).toContain('css')
|
|
14
|
+
expect(first.url).toStartWith('http')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('respects the limit', async () => {
|
|
18
|
+
const results = await w3cSearch('CSS', 5)
|
|
19
|
+
|
|
20
|
+
expect(results.length).toBeLessThanOrEqual(5)
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as cache from '../cache.ts'
|
|
2
|
+
|
|
3
|
+
// The W3C API accepts a `q` parameter and ignores it: 'css' and a nonsense string both return all
|
|
4
|
+
// 1713 specifications.
|
|
5
|
+
// So the whole list is fetched and filtered here, 1000 per page.
|
|
6
|
+
const API_URL = 'https://api.w3.org/specifications'
|
|
7
|
+
const PAGE_SIZE = 1000
|
|
8
|
+
const DEFAULT_LIMIT = 20
|
|
9
|
+
|
|
10
|
+
export type W3cResult = {
|
|
11
|
+
title: string
|
|
12
|
+
url: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type Spec = {
|
|
16
|
+
title?: string
|
|
17
|
+
href?: string
|
|
18
|
+
'shortlink'?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type Page = {
|
|
22
|
+
pages?: number
|
|
23
|
+
_links?: { specifications?: Spec[] }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const fetchPage = async (page: number): Promise<Page> => {
|
|
27
|
+
const params = new URLSearchParams({ items: String(PAGE_SIZE), page: String(page) })
|
|
28
|
+
const res = await fetch(API_URL + '?' + params)
|
|
29
|
+
|
|
30
|
+
if (!res.ok) throw new Error('W3C API returned ' + res.status + ' ' + res.statusText)
|
|
31
|
+
|
|
32
|
+
return await res.json() as Page
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const w3cSearch = async (query: string, limit = DEFAULT_LIMIT): Promise<W3cResult[]> => {
|
|
36
|
+
const cacheKey = 'w3c:' + query
|
|
37
|
+
|
|
38
|
+
const cached = await cache.get<W3cResult[]>(cacheKey)
|
|
39
|
+
if (cached) return cached.slice(0, limit)
|
|
40
|
+
|
|
41
|
+
const first = await fetchPage(1)
|
|
42
|
+
const specs = [...first._links?.specifications ?? []]
|
|
43
|
+
|
|
44
|
+
// `pages` counts pages at the requested size, so a second fetch covers the rest at 1000 each.
|
|
45
|
+
const total = first.pages ?? 1
|
|
46
|
+
for (let page = 2; page <= total; page++) {
|
|
47
|
+
const next = await fetchPage(page)
|
|
48
|
+
specs.push(...next._links?.specifications ?? [])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const needle = query.toLowerCase()
|
|
52
|
+
const results: W3cResult[] = []
|
|
53
|
+
|
|
54
|
+
for (const spec of specs) {
|
|
55
|
+
const title = spec.title ?? ''
|
|
56
|
+
const url = spec.shortlink ?? spec.href ?? ''
|
|
57
|
+
|
|
58
|
+
if (!title || !url) continue
|
|
59
|
+
if (!title.toLowerCase().includes(needle)) continue
|
|
60
|
+
|
|
61
|
+
results.push({ title, url })
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
await cache.set(cacheKey, results)
|
|
65
|
+
|
|
66
|
+
return results.slice(0, limit)
|
|
67
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
import { whatwgSearch } from './whatwg-search.ts'
|
|
3
|
+
|
|
4
|
+
describe('whatwgSearch', () => {
|
|
5
|
+
it('finds a living standard by name', async () => {
|
|
6
|
+
const results = await whatwgSearch('HTML')
|
|
7
|
+
|
|
8
|
+
expect(results.length).toBeGreaterThan(0)
|
|
9
|
+
|
|
10
|
+
const first = results[0]
|
|
11
|
+
if (!first) throw new Error('Expected at least one standard')
|
|
12
|
+
|
|
13
|
+
expect(first.url).toContain('spec.whatwg.org')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('returns nothing for a query that matches no standard', async () => {
|
|
17
|
+
const results = await whatwgSearch('zzzznotastandard')
|
|
18
|
+
|
|
19
|
+
expect(results.length).toEqual(0)
|
|
20
|
+
})
|
|
21
|
+
})
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as cache from '../cache.ts'
|
|
2
|
+
|
|
3
|
+
// WHATWG publishes its whole standards index as one small JSON file, and offers no search endpoint.
|
|
4
|
+
const DB_URL = 'https://raw.githubusercontent.com/whatwg/sg/main/db.json'
|
|
5
|
+
const DEFAULT_LIMIT = 20
|
|
6
|
+
|
|
7
|
+
export type WhatwgResult = {
|
|
8
|
+
title: string
|
|
9
|
+
url: string
|
|
10
|
+
abstract: string
|
|
11
|
+
workstream: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type Standard = {
|
|
15
|
+
name?: string
|
|
16
|
+
href?: string
|
|
17
|
+
description?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type Workstream = {
|
|
21
|
+
name?: string
|
|
22
|
+
standards?: Standard[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const whatwgSearch = async (query: string, limit = DEFAULT_LIMIT): Promise<WhatwgResult[]> => {
|
|
26
|
+
const cacheKey = 'whatwg:' + query
|
|
27
|
+
|
|
28
|
+
const cached = await cache.get<WhatwgResult[]>(cacheKey)
|
|
29
|
+
if (cached) return cached.slice(0, limit)
|
|
30
|
+
|
|
31
|
+
const res = await fetch(DB_URL)
|
|
32
|
+
|
|
33
|
+
if (!res.ok) throw new Error('WHATWG index returned ' + res.status + ' ' + res.statusText)
|
|
34
|
+
|
|
35
|
+
const body = await res.json() as { workstreams?: Workstream[] }
|
|
36
|
+
const needle = query.toLowerCase()
|
|
37
|
+
const results: WhatwgResult[] = []
|
|
38
|
+
|
|
39
|
+
for (const workstream of body.workstreams ?? []) {
|
|
40
|
+
for (const standard of workstream.standards ?? []) {
|
|
41
|
+
const title = standard.name ?? ''
|
|
42
|
+
const url = standard.href ?? ''
|
|
43
|
+
const abstract = standard.description ?? ''
|
|
44
|
+
|
|
45
|
+
if (!title || !url) continue
|
|
46
|
+
if (!(title + ' ' + abstract).toLowerCase().includes(needle)) continue
|
|
47
|
+
|
|
48
|
+
results.push({ title, url, abstract, workstream: workstream.name ?? '' })
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
await cache.set(cacheKey, results)
|
|
53
|
+
|
|
54
|
+
return results.slice(0, limit)
|
|
55
|
+
}
|
package/src/renderers.ts
CHANGED
|
@@ -4,6 +4,9 @@ import type { BskyPost } from './providers/bsky-search.ts'
|
|
|
4
4
|
import type { DdgResult } from './providers/ddg-search.ts'
|
|
5
5
|
import type { GnewsResult } from './providers/gnews-search.ts'
|
|
6
6
|
import type { MdnDocument } from './providers/mdn-search.ts'
|
|
7
|
+
import type { RfcResult } from './providers/rfc-search.ts'
|
|
8
|
+
import type { W3cResult } from './providers/w3c-search.ts'
|
|
9
|
+
import type { WhatwgResult } from './providers/whatwg-search.ts'
|
|
7
10
|
import type { WikiPage } from './providers/wiki-search.ts'
|
|
8
11
|
|
|
9
12
|
export const renderDdgResult = (result: DdgResult, index: number): string => {
|
|
@@ -40,3 +43,20 @@ export const renderMdnDoc = (doc: MdnDocument, index: number): string => {
|
|
|
40
43
|
https://developer.mozilla.org${doc.mdn_url}
|
|
41
44
|
${normalizeBlurb(doc.summary)}`
|
|
42
45
|
}
|
|
46
|
+
|
|
47
|
+
export const renderRfc = (result: RfcResult, index: number): string => {
|
|
48
|
+
return `${index + 1}. ${result.id} — ${result.title}
|
|
49
|
+
${result.url}
|
|
50
|
+
${normalizeBlurb(result.abstract)}`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const renderW3c = (result: W3cResult, index: number): string => {
|
|
54
|
+
return `${index + 1}. ${result.title}
|
|
55
|
+
${result.url}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const renderWhatwg = (result: WhatwgResult, index: number): string => {
|
|
59
|
+
return `${index + 1}. ${result.title}
|
|
60
|
+
${result.url}
|
|
61
|
+
${normalizeBlurb(result.abstract)}`
|
|
62
|
+
}
|
package/src/search.ts
CHANGED
|
@@ -7,12 +7,18 @@ import { bskySearch } from './providers/bsky-search.ts'
|
|
|
7
7
|
import { ddgSearch } from './providers/ddg-search.ts'
|
|
8
8
|
import { gnewsSearch } from './providers/gnews-search.ts'
|
|
9
9
|
import { mdnSearch } from './providers/mdn-search.ts'
|
|
10
|
+
import { rfcSearch } from './providers/rfc-search.ts'
|
|
11
|
+
import { w3cSearch } from './providers/w3c-search.ts'
|
|
12
|
+
import { whatwgSearch } from './providers/whatwg-search.ts'
|
|
10
13
|
import { wikiSearch } from './providers/wiki-search.ts'
|
|
11
14
|
import {
|
|
12
15
|
renderBskyPost,
|
|
13
16
|
renderDdgResult,
|
|
14
17
|
renderGnewsItem,
|
|
15
18
|
renderMdnDoc,
|
|
19
|
+
renderRfc,
|
|
20
|
+
renderW3c,
|
|
21
|
+
renderWhatwg,
|
|
16
22
|
renderWebResult,
|
|
17
23
|
renderWikiPage,
|
|
18
24
|
} from './renderers.ts'
|
|
@@ -57,7 +63,11 @@ const queryArg = {
|
|
|
57
63
|
|
|
58
64
|
export const createDdgSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
59
65
|
name: 'ddg_search',
|
|
60
|
-
description:
|
|
66
|
+
description: [
|
|
67
|
+
'Search the web with DuckDuckGo when you need current information from the internet.',
|
|
68
|
+
'Use for general web queries: products, people, events, how-tos, anything not covered by a more specific tool.',
|
|
69
|
+
'Returns titles, URLs and snippets.',
|
|
70
|
+
].join(' '),
|
|
61
71
|
input: queryArg,
|
|
62
72
|
async execute(input, ctx) {
|
|
63
73
|
const query = stringField(input, 'query')
|
|
@@ -80,7 +90,11 @@ export const createDdgSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
|
80
90
|
|
|
81
91
|
export const createBraveSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
82
92
|
name: 'brave_search',
|
|
83
|
-
description:
|
|
93
|
+
description: [
|
|
94
|
+
'Search the web with Brave when you need current information from the internet.',
|
|
95
|
+
'The most reliable general web search here; prefer it over ddg_search when either would do.',
|
|
96
|
+
'Returns titles, URLs and snippets.',
|
|
97
|
+
].join(' '),
|
|
84
98
|
input: queryArg,
|
|
85
99
|
async execute(input, ctx) {
|
|
86
100
|
const query = stringField(input, 'query')
|
|
@@ -104,8 +118,9 @@ export const createBraveSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
|
104
118
|
export const createBskySearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
105
119
|
name: 'bsky_search',
|
|
106
120
|
description: [
|
|
107
|
-
'Search Bluesky posts
|
|
108
|
-
'
|
|
121
|
+
'Search Bluesky posts for what people are saying about a topic right now.',
|
|
122
|
+
'Use for public reaction, discussion and opinion, not for documentation or reference material.',
|
|
123
|
+
'Returns author handle, post text, and like, repost and reply counts.',
|
|
109
124
|
].join(' '),
|
|
110
125
|
input: {
|
|
111
126
|
type: 'object',
|
|
@@ -145,7 +160,11 @@ export const createBskySearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
|
145
160
|
|
|
146
161
|
export const createWikiSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
147
162
|
name: 'wiki_search',
|
|
148
|
-
description:
|
|
163
|
+
description: [
|
|
164
|
+
'Look up a subject on Wikipedia for background, definitions and general reference.',
|
|
165
|
+
'Use when the question is about what something IS rather than what is happening with it.',
|
|
166
|
+
'Returns page titles, descriptions and excerpts.',
|
|
167
|
+
].join(' '),
|
|
149
168
|
input: {
|
|
150
169
|
type: 'object',
|
|
151
170
|
properties: {
|
|
@@ -183,9 +202,9 @@ export const createWikiSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
|
183
202
|
export const createGnewsSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
184
203
|
name: 'gnews_search',
|
|
185
204
|
description: [
|
|
186
|
-
'Search Google News for recent
|
|
205
|
+
'Search Google News for recent news coverage of a topic.',
|
|
187
206
|
'News and tech media only — not general web search, and not documentation.',
|
|
188
|
-
'Links are news.google.com redirect URLs, not publisher URLs.',
|
|
207
|
+
'Links are news.google.com redirect URLs that only open in a browser, not publisher URLs.',
|
|
189
208
|
].join(' '),
|
|
190
209
|
input: {
|
|
191
210
|
type: 'object',
|
|
@@ -218,7 +237,11 @@ export const createGnewsSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
|
218
237
|
|
|
219
238
|
export const createMdnSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
220
239
|
name: 'mdn_search',
|
|
221
|
-
description:
|
|
240
|
+
description: [
|
|
241
|
+
'Look up web platform documentation on MDN: JavaScript, CSS, HTML, and browser APIs.',
|
|
242
|
+
'Use for how a web API behaves, its syntax, parameters or browser support.',
|
|
243
|
+
'Returns documentation pages with titles, URLs and summaries.',
|
|
244
|
+
].join(' '),
|
|
222
245
|
input: {
|
|
223
246
|
type: 'object',
|
|
224
247
|
properties: {
|
|
@@ -254,11 +277,125 @@ export const createMdnSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
|
254
277
|
},
|
|
255
278
|
})
|
|
256
279
|
|
|
280
|
+
export const createRfcSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
281
|
+
name: 'rfc_search',
|
|
282
|
+
description: [
|
|
283
|
+
'Look up an IETF RFC by number or title.',
|
|
284
|
+
'Accepts a number like 9421, RFC9421 or \'rfc 9421\' for a direct lookup, or words from the title to search.',
|
|
285
|
+
'Use for internet protocol specifications: HTTP, TCP, TLS, DNS, email, and so on.',
|
|
286
|
+
'Returns the RFC number, title, date, abstract, and a link to the full text.',
|
|
287
|
+
].join(' '),
|
|
288
|
+
input: {
|
|
289
|
+
type: 'object',
|
|
290
|
+
properties: {
|
|
291
|
+
query: { type: 'string', description: "An RFC number like 9421 or 'RFC9421', or words from the title" },
|
|
292
|
+
limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
|
|
293
|
+
},
|
|
294
|
+
required: ['query'],
|
|
295
|
+
additionalProperties: false,
|
|
296
|
+
},
|
|
297
|
+
async execute(input, ctx) {
|
|
298
|
+
const query = stringField(input, 'query')
|
|
299
|
+
const limit = numberField(input, 'limit')
|
|
300
|
+
|
|
301
|
+
const { data, error } = await safeAsync(() => rfcSearch(query, limit))
|
|
302
|
+
if (error) return textOutput('RFC search failed: ' + error.message)
|
|
303
|
+
|
|
304
|
+
const formatted = formatResults({
|
|
305
|
+
label: 'RFC results',
|
|
306
|
+
items: data,
|
|
307
|
+
total: data.length,
|
|
308
|
+
renderItem: renderRfc,
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
await postResult(context, ctx, formatted)
|
|
312
|
+
|
|
313
|
+
return textOutput(formatted)
|
|
314
|
+
},
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
export const createW3cSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
318
|
+
name: 'w3c_search',
|
|
319
|
+
description: [
|
|
320
|
+
'Look up a W3C specification by words in its title.',
|
|
321
|
+
'Use for web standards W3C publishes: CSS, WCAG accessibility, SVG, WebRTC, and similar.',
|
|
322
|
+
'Matches titles only, so query the spec name rather than a concept inside it.',
|
|
323
|
+
'Returns the specification title and URL.',
|
|
324
|
+
].join(' '),
|
|
325
|
+
input: {
|
|
326
|
+
type: 'object',
|
|
327
|
+
properties: {
|
|
328
|
+
query: { type: 'string', description: 'The search query' },
|
|
329
|
+
limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
|
|
330
|
+
},
|
|
331
|
+
required: ['query'],
|
|
332
|
+
additionalProperties: false,
|
|
333
|
+
},
|
|
334
|
+
async execute(input, ctx) {
|
|
335
|
+
const query = stringField(input, 'query')
|
|
336
|
+
const limit = numberField(input, 'limit')
|
|
337
|
+
|
|
338
|
+
const { data, error } = await safeAsync(() => w3cSearch(query, limit))
|
|
339
|
+
if (error) return textOutput('W3C search failed: ' + error.message)
|
|
340
|
+
|
|
341
|
+
const formatted = formatResults({
|
|
342
|
+
label: 'W3C results',
|
|
343
|
+
items: data,
|
|
344
|
+
total: data.length,
|
|
345
|
+
renderItem: renderW3c,
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
await postResult(context, ctx, formatted)
|
|
349
|
+
|
|
350
|
+
return textOutput(formatted)
|
|
351
|
+
},
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
export const createWhatwgSearchTool = (context: Plugin.Context): Tool.Info => ({
|
|
355
|
+
name: 'whatwg_search',
|
|
356
|
+
description: [
|
|
357
|
+
'Look up a WHATWG living standard such as HTML, DOM, Fetch, URL or Streams.',
|
|
358
|
+
'Use for the current web platform specs WHATWG maintains, which supersede older W3C versions.',
|
|
359
|
+
'There are only 27 standards, so expect few results.',
|
|
360
|
+
'Returns the standard name, URL and description.',
|
|
361
|
+
].join(' '),
|
|
362
|
+
input: {
|
|
363
|
+
type: 'object',
|
|
364
|
+
properties: {
|
|
365
|
+
query: { type: 'string', description: 'The search query' },
|
|
366
|
+
limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
|
|
367
|
+
},
|
|
368
|
+
required: ['query'],
|
|
369
|
+
additionalProperties: false,
|
|
370
|
+
},
|
|
371
|
+
async execute(input, ctx) {
|
|
372
|
+
const query = stringField(input, 'query')
|
|
373
|
+
const limit = numberField(input, 'limit')
|
|
374
|
+
|
|
375
|
+
const { data, error } = await safeAsync(() => whatwgSearch(query, limit))
|
|
376
|
+
if (error) return textOutput('WHATWG search failed: ' + error.message)
|
|
377
|
+
|
|
378
|
+
const formatted = formatResults({
|
|
379
|
+
label: 'WHATWG results',
|
|
380
|
+
items: data,
|
|
381
|
+
total: data.length,
|
|
382
|
+
renderItem: renderWhatwg,
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
await postResult(context, ctx, formatted)
|
|
386
|
+
|
|
387
|
+
return textOutput(formatted)
|
|
388
|
+
},
|
|
389
|
+
})
|
|
390
|
+
|
|
257
391
|
export const createSearchTools = (context: Plugin.Context): Tool.Info[] => [
|
|
258
392
|
createBraveSearchTool(context),
|
|
259
393
|
createBskySearchTool(context),
|
|
260
394
|
createDdgSearchTool(context),
|
|
261
395
|
createGnewsSearchTool(context),
|
|
262
396
|
createMdnSearchTool(context),
|
|
397
|
+
createRfcSearchTool(context),
|
|
398
|
+
createW3cSearchTool(context),
|
|
399
|
+
createWhatwgSearchTool(context),
|
|
263
400
|
createWikiSearchTool(context),
|
|
264
401
|
]
|