feat: prepare deep search production runtime
Memind CI / Test, build, and release guards (pull_request) Successful in 4m4s

This commit is contained in:
john
2026-07-24 09:53:06 +08:00
parent 46041c3456
commit 53ed38c250
16 changed files with 681 additions and 9 deletions
+26 -1
View File
@@ -281,7 +281,23 @@ test('Deep Search supports cancellation while a provider is running', async () =
test('Deep Search HTTP service exposes health, async start, status, search, and auth', async (t) => {
const { engine, store } = createMockEngine({ id: 'task-http' });
const server = createDeepSearchHttpServer({ engine, secret: 'local-secret', logger: { warn() {} } });
let githubRequest;
const server = createDeepSearchHttpServer({
engine,
secret: 'local-secret',
githubToken: 'github-secret-token',
githubSearch: async (query, options) => {
githubRequest = { query, options };
return [{
title: 'tkmind/code:server.mjs',
url: 'https://github.com/tkmind/code/blob/main/server.mjs',
snippet: 'server',
source: 'github',
rank: 1,
}];
},
logger: { warn() {} },
});
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
t.after(async () => {
await new Promise((resolve) => server.close(resolve));
@@ -291,8 +307,17 @@ test('Deep Search HTTP service exposes health, async start, status, search, and
const base = `http://127.0.0.1:${address.port}`;
const health = await fetch(`${base}/health`).then((response) => response.json());
assert.equal(health.ok, true);
assert.equal(health.providers.github.configured, true);
assert.equal((await fetch(`${base}/v1/research`)).status, 401);
const headers = { 'content-type': 'application/json', 'x-secret-key': 'local-secret' };
const github = await fetch(`${base}/v1/providers/github/search`, {
method: 'POST',
headers,
body: JSON.stringify({ query: 'repo:tkmind/code server', limit: 3 }),
}).then((response) => response.json());
assert.equal(github.results.length, 1);
assert.equal(githubRequest.options.token, 'github-secret-token');
assert.equal(githubRequest.options.limit, 3);
const search = await fetch(`${base}/v1/search`, {
method: 'POST',
headers,