@nite07/search-core 0.1.7 → 0.1.8
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 +12 -0
- package/README.zh.md +11 -0
- package/dist/catalog.js +1 -1
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.js +68 -48
- package/dist/transport.d.ts +5 -0
- package/dist/transport.js +24 -23
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@nite07/search-core)
|
|
6
|
+
[](https://www.npmjs.com/package/@nite07/search-core)
|
|
7
|
+
[](package.json)
|
|
8
|
+
|
|
5
9
|
A provider-agnostic multi-backend web search engine in TypeScript. It ships the backend catalog, the
|
|
6
10
|
per-backend adapters, the HTTP transport and a single `SearchEngine`, with no dependency on any host
|
|
7
11
|
framework — the [DeepSeek Harness plugin](../dsh-search/README.md) and the [MCP server](../websearch-mcp/README.md)
|
|
@@ -87,6 +91,14 @@ empty list, and failures are never cached.
|
|
|
87
91
|
`search(input, signal?, onlyBackend?, overrides?)` accepts per-call strategy overrides — `mode`,
|
|
88
92
|
`backends`, `exclude`, `backend`, `compact`, `maxResults` — without touching the saved configuration.
|
|
89
93
|
|
|
94
|
+
## MCP-backed backends
|
|
95
|
+
|
|
96
|
+
`exa`, `parallel` and `you` have an anonymous mode that is a remote MCP endpoint. That protocol is
|
|
97
|
+
served by [`@modelcontextprotocol/client`](https://ts.sdk.modelcontextprotocol.io/v2/): it negotiates
|
|
98
|
+
the revision, replays `Mcp-Session-Id`, and parses both JSON and SSE answers. What stays in this
|
|
99
|
+
package is what belongs to it — which tool to call, a pre-flight check of the parameters against the
|
|
100
|
+
tool's schema, and the failure wording a search panel can show.
|
|
101
|
+
|
|
90
102
|
## Modes of access
|
|
91
103
|
|
|
92
104
|
A backend is used in exactly the mode you selected: `anonymous`, `key`, `oauth`, `session` or
|
package/README.zh.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@nite07/search-core)
|
|
6
|
+
[](https://www.npmjs.com/package/@nite07/search-core)
|
|
7
|
+
[](package.json)
|
|
8
|
+
|
|
5
9
|
一个不绑定宿主的 TypeScript 多后端网页搜索引擎。后端目录、各家的适配层、HTTP 传输和一个 `SearchEngine` 都在这里,不依赖任何宿主框架——[DeepSeek Harness 插件](../dsh-search/README.zh.md) 和 [MCP 服务](../websearch-mcp/README.zh.md) 都只是它的外壳。
|
|
6
10
|
|
|
7
11
|
## 安装
|
|
@@ -77,6 +81,13 @@ result.outcomes; // 每个后端的细节:ok、错误类型、耗时、尝试
|
|
|
77
81
|
|
|
78
82
|
`search(input, signal?, onlyBackend?, overrides?)` 支持单次调用的策略覆盖:`mode`、`backends`、`exclude`、`backend`、`compact`、`maxResults`,不改动已保存的配置。
|
|
79
83
|
|
|
84
|
+
## 走 MCP 的后端
|
|
85
|
+
|
|
86
|
+
`exa`、`parallel`、`you` 的匿名模式连的是远端 MCP 端点。那套协议交给
|
|
87
|
+
[`@modelcontextprotocol/client`](https://ts.sdk.modelcontextprotocol.io/v2/):版本协商、`Mcp-Session-Id`
|
|
88
|
+
回放、JSON 与 SSE 两种应答的解析都在库里。留在这个包里的只有属于它自己的东西——调哪个工具、
|
|
89
|
+
按工具 schema 做一次调用前校验、以及搜索面板能显示的错误文案。
|
|
90
|
+
|
|
80
91
|
## 接入模式
|
|
81
92
|
|
|
82
93
|
后端只按你选定的模式工作:`anonymous`、`key`、`oauth`、`session` 或 `browser`。模式、密钥、端点之间都不会自动切换,重试也留在同一家、同一模式。只重试配置里列出的 HTTP 状态码,`Retry-After` 会被遵守,重试不会换服务商。
|
package/dist/catalog.js
CHANGED
|
@@ -25,7 +25,7 @@ export const catalog = [
|
|
|
25
25
|
backend('serpex', 'Serpex', 'https://serpex.dev/docs/api/search', [mode('key', 'https://api.serpex.dev/api/search', 'trial', '200 one-time credits; paid top-ups start around $0.80/1,000. Vendor routes internally; no fixed upstream engine.', '一次性 200 credits;充值约 $0.80/千次起;供应商内部路由,不能固定其上游引擎。', 'https://serpex.dev/docs/getting-started/pricing')]),
|
|
26
26
|
backend('x', 'X (Twitter)', 'https://docs.x.com/x-api/posts/search/quickstart/recent-search', [mode('session', 'https://x.com/i/api/graphql', 'account', 'Uses the browser session cookies (auth_token, ct0) of your own X account. No fee, but X changes its request signing and query ids regularly, so this mode can break until the adapter is updated.', '使用你自己 X 账号的网页 cookie(auth_token、ct0)。不产生费用,但 X 会不定期改动前端签名与 queryId,失效后需要维护者更新适配器。', 'https://github.com/bestnite/x-mcp', { en: '{"authToken":"...","ct0":"..."}, or paste auth_token=...; ct0=... straight from DevTools', zh: '{"authToken":"...","ct0":"..."},也可以直接粘贴浏览器里的 auth_token=...; ct0=...' }), mode('key', 'https://api.x.com/2/tweets/search/recent', 'paid', 'Official API with an app-only bearer token as the key. Pay per post read: about $0.005 each, so a 10-result search costs roughly $0.05. Recent search covers the last 7 days; reads are capped by the posts-per-search option.', '官方 API,密钥填 app-only bearer token。按读取帖数计费:约 $0.005/条,取 10 条约 $0.05。近期搜索只覆盖最近 7 天,读取条数受「每次搜索帖数」参数限制。', 'https://docs.x.com/x-api/getting-started/pricing', { en: '{"bearerToken":"<app-only bearer token>"}', zh: '{"bearerToken":"<app-only bearer 令牌>"}' })], [option('postsPerSearch', 'Posts read per search', '每次搜索读取帖数', 10)], ['recency']),
|
|
27
27
|
backend('reddit', 'Reddit', 'https://github.com/reddit-archive/reddit/wiki/API', [mode('anonymous', 'https://gql-fed.reddit.com/', 'free', 'No credentials. Uses the Reddit Android app endpoint, because the public REST search and comments endpoints answer 403 to anonymous tokens since 2026-10. No published quota; shared rate limits.', '无需凭证。走 Reddit 安卓客户端端点——自 2026-10 起公开 REST 的搜索与评论对匿名 token 一律返回 403。额度未公布,属共享限流。', 'https://github.com/bestnite/reddit-readonly-mcp'), mode('oauth', 'https://oauth.reddit.com/search', 'allowance', 'Official OAuth API: about 100 queries/minute per client for non-commercial use. client_credentials reads public data; add a username and password for a script grant.', '官方 OAuth API:非商业用途约每客户端 100 次/分钟。client_credentials 即可读公开数据;补用户名密码则用 script 授权。', 'https://support.reddithelp.com/hc/en-us/articles/16160319875092-Reddit-Data-API-Wiki', { en: '{"clientId":"...","clientSecret":"..."}; add "username" and "password" for a script grant', zh: '{"clientId":"...","clientSecret":"..."};需要脚本授权就再加 "username" 与 "password"' })], [option('sort', 'Sort', '排序', 'relevance', ['relevance', 'hot', 'top', 'new', 'comments']), option('time', 'Time window', '时间范围', 'all', ['all', 'hour', 'day', 'week', 'month', 'year']), option('subreddit', 'Limit to subreddit', '限定版块', '')], ['recency']),
|
|
28
|
-
backend('xiaohongshu', 'Xiaohongshu', 'https://git.nite07.com/nite/search
|
|
28
|
+
backend('xiaohongshu', 'Xiaohongshu', 'https://git.nite07.com/nite/search/src/branch/main/packages/core/image', [mode('browser', 'ws://127.0.0.1:3000/ws', 'self-hosted', 'Reads run through a browser you host, so nothing is billed per call and no public quota applies. The browser must be signed in to Xiaohongshu; this project ships an image that provides that browser, a VNC login surface and a token-protected endpoint.', '读取走你自己托管的浏览器,不按次计费、无公开额度。浏览器需要处于小红书登录状态;本项目提供一个镜像,内含浏览器、VNC 登录界面和带令牌的端点。', 'https://git.nite07.com/nite/search/src/branch/main/packages/core/image', { en: 'Bearer token printed by the browser container at startup. Set it once in the shared browser settings; it protects the browser endpoint, not a site account', zh: '浏览器容器启动时打印的 Bearer 令牌。在共享浏览器设置中填写一次即可;它保护浏览器端点,不是网站账户凭证' })], [option('sort', 'Sort', '排序', 'general', ['general', 'time_descending', 'popularity_descending']), { key: 'statePath', type: 'string', label: text('Session state file', '会话状态文件'), help: text('Where the signed-in session is read from. Leave empty to use the core default (~/.config/dsh-search/browser/state.json), which has to be the file the browser container writes.', '登录态从哪个文件读取。留空则用核心默认位置(~/.config/dsh-search/browser/state.json),它必须和浏览器容器写出的文件是同一个。'), default: '' }], [], 'documented', 'live'),
|
|
29
29
|
backend('tencent-wsa', 'Tencent Cloud WSA', 'https://cloud.tencent.com/document/product/1806/121811', [mode('key', 'https://wsa.tencentcloudapi.com/', 'paid', '¥14/¥20/¥26 per 1,000 by tier. Store a JSON credential {secretId,secretKey}; no free allowance verified.', '分档 ¥14/¥20/¥26 每千次。凭证填写 JSON {secretId,secretKey};免费额度未核实。', 'https://cloud.tencent.com/product/wsa', { en: '{"secretId":"...","secretKey":"..."}', zh: '{"secretId":"...","secretKey":"..."}' })], [{ ...option('Mode', 'Search mode', '搜索模式', 0), min: 0, max: 2 }]),
|
|
30
30
|
];
|
|
31
31
|
export const backendById = (id) => catalog.find(item => item.id === id);
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type TransportOptions } from './transport.js';
|
|
2
2
|
type Row = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* The anonymous MCP endpoints of exa, parallel and you. The wire protocol belongs to
|
|
5
|
+
* `@modelcontextprotocol/client`: it negotiates the revision, carries `Mcp-Session-Id`, and parses
|
|
6
|
+
* both JSON and SSE responses. What stays here is only what this project owns — which tool to call,
|
|
7
|
+
* and a readable failure instead of a raw transport exception.
|
|
8
|
+
*/
|
|
3
9
|
export declare function callMcp(endpoint: string, tool: string, args: Record<string, unknown>, transport: TransportOptions): Promise<Row>;
|
|
4
10
|
export {};
|
package/dist/mcp.js
CHANGED
|
@@ -1,57 +1,77 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
|
2
|
+
import { abortError, fetchWithPolicy, SearchError } from './transport.js';
|
|
2
3
|
const row = (v) => v && typeof v === 'object' && !Array.isArray(v) ? v : {};
|
|
4
|
+
/**
|
|
5
|
+
* The anonymous MCP endpoints of exa, parallel and you. The wire protocol belongs to
|
|
6
|
+
* `@modelcontextprotocol/client`: it negotiates the revision, carries `Mcp-Session-Id`, and parses
|
|
7
|
+
* both JSON and SSE responses. What stays here is only what this project owns — which tool to call,
|
|
8
|
+
* and a readable failure instead of a raw transport exception.
|
|
9
|
+
*/
|
|
3
10
|
export async function callMcp(endpoint, tool, args, transport) {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let packets;
|
|
10
|
-
try {
|
|
11
|
-
packets = text.trim().startsWith('{') ? [JSON.parse(text)] : text.split(/\r?\n/).filter(l => l.startsWith('data:')).map(l => { try {
|
|
12
|
-
return JSON.parse(l.slice(5));
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return undefined;
|
|
16
|
-
} });
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
throw new SearchError('protocol', 'MCP returned invalid JSON/SSE.');
|
|
20
|
-
}
|
|
21
|
-
const packet = packets.find(p => row(p).id === id);
|
|
22
|
-
if (!packet || !('result' in row(packet)) && !('error' in row(packet)))
|
|
23
|
-
throw new SearchError('protocol', 'MCP response is missing the matching result.');
|
|
24
|
-
const response = row(packet);
|
|
25
|
-
if (response.error)
|
|
26
|
-
throw new SearchError('protocol', 'MCP server rejected the operation.');
|
|
27
|
-
return row(response.result);
|
|
11
|
+
const client = new Client({ name: 'dsh-search', version: '0.1.0' }, { capabilities: {} });
|
|
12
|
+
// Only the search itself counts as an attempt, as before: the handshake is overhead, not a try.
|
|
13
|
+
const counting = (init) => {
|
|
14
|
+
const body = typeof init?.body === 'string' ? init.body : '';
|
|
15
|
+
return body.includes('"tools/call"') ? transport : { ...transport, beforeAttempt: () => { }, onAttempt: () => { } };
|
|
28
16
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
const session = new StreamableHTTPClientTransport(new URL(endpoint), {
|
|
18
|
+
fetch: (input, init) => fetchWithPolicy(String(input), init ?? {}, counting(init)),
|
|
19
|
+
});
|
|
20
|
+
try {
|
|
21
|
+
await client.connect(session);
|
|
22
|
+
const advertised = await client.listTools();
|
|
23
|
+
const definition = advertised.tools.find(candidate => candidate.name === tool);
|
|
24
|
+
if (!definition)
|
|
25
|
+
throw new SearchError('protocol', 'Configured MCP search tool is not advertised by the provider.');
|
|
26
|
+
validateArguments(row(definition.inputSchema), args);
|
|
27
|
+
const result = await client.callTool({ name: tool, arguments: args }, { signal: transport.signal });
|
|
28
|
+
if (result.isError)
|
|
29
|
+
throw new SearchError('protocol', 'MCP search tool reported failure; check account and quota.');
|
|
30
|
+
return row(result);
|
|
31
|
+
}
|
|
32
|
+
catch (caught) {
|
|
33
|
+
throw asSearchError(caught, transport);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
await Promise.allSettled([client.close(), session.close()]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Reject a configuration the tool cannot accept before spending a request on it. */
|
|
40
|
+
function validateArguments(schema, args) {
|
|
41
|
+
if (schema.oneOf || schema.anyOf)
|
|
45
42
|
throw new SearchError('protocol', 'MCP tool uses an unsupported composite input schema.');
|
|
46
|
-
const properties = row(
|
|
43
|
+
const properties = row(schema.properties);
|
|
47
44
|
for (const key of Object.keys(args))
|
|
48
|
-
if (!(key in properties) &&
|
|
45
|
+
if (!(key in properties) && schema.additionalProperties !== true)
|
|
49
46
|
throw new SearchError('protocol', `MCP tool does not support the configured ${key} parameter.`);
|
|
50
|
-
for (const required of Array.isArray(
|
|
47
|
+
for (const required of Array.isArray(schema.required) ? schema.required : [])
|
|
51
48
|
if (!(required in args))
|
|
52
49
|
throw new SearchError('protocol', 'MCP tool requires an unsupported input parameter.');
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
}
|
|
51
|
+
/** Transport failures keep their kind; protocol failures get the wording this project already used. */
|
|
52
|
+
function asSearchError(caught, transport) {
|
|
53
|
+
const original = findSearchError(caught);
|
|
54
|
+
if (original)
|
|
55
|
+
return original;
|
|
56
|
+
if (transport.signal.aborted)
|
|
57
|
+
return abortError(transport.signal);
|
|
58
|
+
const carried = caught;
|
|
59
|
+
const message = typeof carried?.message === 'string' ? carried.message : '';
|
|
60
|
+
if (typeof carried?.code === 'number')
|
|
61
|
+
return new SearchError('protocol', 'MCP server rejected the operation.');
|
|
62
|
+
if (/invalid json|unexpected token|json parse|parse error/i.test(message))
|
|
63
|
+
return new SearchError('protocol', 'MCP returned invalid JSON/SSE.');
|
|
64
|
+
if (/http\s*\d{3}|unexpected status|bad status|non-2\d\d/i.test(message))
|
|
65
|
+
return new SearchError('protocol', 'MCP server rejected the operation.');
|
|
66
|
+
return new SearchError('protocol', 'MCP response is missing the matching result.');
|
|
67
|
+
}
|
|
68
|
+
/** The SDK wraps what the injected fetch throws; the original kind must survive the wrapping. */
|
|
69
|
+
function findSearchError(caught) {
|
|
70
|
+
let current = caught;
|
|
71
|
+
for (let depth = 0; current && depth < 6; depth += 1) {
|
|
72
|
+
if (current instanceof SearchError)
|
|
73
|
+
return current;
|
|
74
|
+
current = current.cause;
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
57
77
|
}
|
package/dist/transport.d.ts
CHANGED
|
@@ -16,5 +16,10 @@ export interface TransportOptions {
|
|
|
16
16
|
export declare function abortError(signal: AbortSignal): SearchError;
|
|
17
17
|
export declare function delay(ms: number, signal: AbortSignal): Promise<void>;
|
|
18
18
|
export declare function retryAfter(value: string | null, now?: number): number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The retry, deadline and redirect policy every adapter shares. It returns a Response so callers
|
|
21
|
+
* that speak a protocol (MCP) can hand it to their own client, and requestText sits on top of it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchWithPolicy(url: string, init: RequestInit, options: TransportOptions): Promise<Response>;
|
|
19
24
|
export declare function requestText(url: string, init: RequestInit, options: TransportOptions): Promise<string>;
|
|
20
25
|
export declare function requestJson(url: string, init: RequestInit, options: TransportOptions): Promise<unknown>;
|
package/dist/transport.js
CHANGED
|
@@ -18,7 +18,11 @@ export function retryAfter(value, now = Date.now()) { if (!value)
|
|
|
18
18
|
return; const seconds = Number(value); if (Number.isFinite(seconds) && seconds >= 0)
|
|
19
19
|
return seconds * 1000; const time = Date.parse(value); if (Number.isFinite(time))
|
|
20
20
|
return Math.max(0, time - now); }
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The retry, deadline and redirect policy every adapter shares. It returns a Response so callers
|
|
23
|
+
* that speak a protocol (MCP) can hand it to their own client, and requestText sits on top of it.
|
|
24
|
+
*/
|
|
25
|
+
export async function fetchWithPolicy(url, init, options) {
|
|
22
26
|
const fetcher = options.fetch ?? fetch;
|
|
23
27
|
let attempts = 0;
|
|
24
28
|
for (;;) {
|
|
@@ -30,33 +34,15 @@ export async function requestText(url, init, options) {
|
|
|
30
34
|
attempts++;
|
|
31
35
|
options.onAttempt();
|
|
32
36
|
const timeout = AbortSignal.timeout(options.attemptTimeoutMs);
|
|
33
|
-
const signal = AbortSignal.any([options.signal, timeout]);
|
|
37
|
+
const signal = AbortSignal.any(init.signal ? [options.signal, timeout, init.signal] : [options.signal, timeout]);
|
|
34
38
|
let error;
|
|
35
39
|
let wait;
|
|
36
40
|
try {
|
|
37
41
|
const response = await fetcher(url, { ...initWithAppUserAgent(init), signal, redirect: 'error' });
|
|
38
|
-
// Bound response bytes before parsing; upstream bodies may include credentials.
|
|
39
|
-
const reader = response.body?.getReader();
|
|
40
|
-
let text = '';
|
|
41
|
-
let bytes = 0;
|
|
42
|
-
if (reader) {
|
|
43
|
-
const decoder = new TextDecoder();
|
|
44
|
-
for (;;) {
|
|
45
|
-
const part = await reader.read();
|
|
46
|
-
if (part.done)
|
|
47
|
-
break;
|
|
48
|
-
bytes += part.value.byteLength;
|
|
49
|
-
if (bytes > 4 * 1024 * 1024) {
|
|
50
|
-
await reader.cancel();
|
|
51
|
-
throw new SearchError('protocol', 'Response exceeds the 4 MiB limit.', response.status, attempts);
|
|
52
|
-
}
|
|
53
|
-
text += decoder.decode(part.value, { stream: true });
|
|
54
|
-
}
|
|
55
|
-
text += decoder.decode();
|
|
56
|
-
}
|
|
57
42
|
if (response.ok)
|
|
58
|
-
return
|
|
59
|
-
const
|
|
43
|
+
return cappedResponse(response, attempts);
|
|
44
|
+
const text = await response.clone().text().then(t => t.slice(0, 32768)).catch(() => '');
|
|
45
|
+
const quota = response.status === 402 || /insufficient[_ -]?(balance|credit|fund)|quota[_ -]?(exhausted|exceeded)|credits?[_ -]?exhausted/i.test(text);
|
|
60
46
|
const kind = quota ? 'quota' : [401, 403].includes(response.status) ? 'authentication' : response.status === 429 ? 'rate-limit' : 'http';
|
|
61
47
|
error = new SearchError(kind, quota ? 'Provider quota exhausted or balance insufficient.' : `HTTP ${response.status}; check backend settings and account status.`, response.status, attempts);
|
|
62
48
|
if (quota || !options.retry.statuses.includes(response.status))
|
|
@@ -89,6 +75,21 @@ export async function requestText(url, init, options) {
|
|
|
89
75
|
await delay(wait ?? Math.min(options.retry.maxDelayMs, options.retry.initialDelayMs * 2 ** (attempts - 1) * (0.8 + Math.random() * 0.4)), options.signal);
|
|
90
76
|
}
|
|
91
77
|
}
|
|
78
|
+
/** Bound response bytes before anyone parses them; upstream bodies may include credentials. */
|
|
79
|
+
function cappedResponse(response, attempts) {
|
|
80
|
+
if (!response.body)
|
|
81
|
+
return response;
|
|
82
|
+
let bytes = 0;
|
|
83
|
+
const bounded = response.body.pipeThrough(new TransformStream({ transform(part, controller) { bytes += part.byteLength; if (bytes > 4 * 1024 * 1024) {
|
|
84
|
+
controller.error(new SearchError('protocol', 'Response exceeds the 4 MiB limit.', response.status, attempts));
|
|
85
|
+
return;
|
|
86
|
+
} controller.enqueue(part); } }));
|
|
87
|
+
return new Response(bounded, { status: response.status, statusText: response.statusText, headers: response.headers });
|
|
88
|
+
}
|
|
89
|
+
export async function requestText(url, init, options) {
|
|
90
|
+
const response = await fetchWithPolicy(url, init, options);
|
|
91
|
+
return await response.text();
|
|
92
|
+
}
|
|
92
93
|
export async function requestJson(url, init, options) { const text = await requestText(url, init, options); try {
|
|
93
94
|
return JSON.parse(text);
|
|
94
95
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nite07/search-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Provider-agnostic multi-backend search engine: backend catalog, adapters, transport and honest failure reporting. No DSH dependency.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "nite07",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"typescript": "^5.7.2"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"@modelcontextprotocol/client": "2.4.0",
|
|
56
57
|
"patchright-core": "1.64.3"
|
|
57
58
|
}
|
|
58
59
|
}
|