md-semantic-search 1.0.3 → 2.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 +132 -16
- package/RESEARCH.md +207 -3
- package/bin/cli.mjs +449 -13
- package/dist/binary-format.js +9 -0
- package/dist/completions.js +11 -1
- package/dist/core.d.ts +42 -4
- package/dist/core.js +208 -14
- package/dist/federation.d.ts +16 -1
- package/dist/federation.js +33 -16
- package/dist/filter.d.ts +7 -0
- package/dist/filter.js +13 -0
- package/dist/hnsw.d.ts +96 -0
- package/dist/hnsw.js +326 -0
- package/dist/index-format.js +8 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/indexer.d.ts +18 -1
- package/dist/indexer.js +92 -18
- package/dist/ivf.d.ts +14 -7
- package/dist/ivf.js +126 -18
- package/dist/lexical.d.ts +10 -0
- package/dist/lexical.js +98 -15
- package/dist/markdown-parser.d.ts +62 -0
- package/dist/markdown-parser.js +227 -30
- package/dist/mcp.d.ts +229 -7
- package/dist/mcp.js +743 -44
- package/dist/models.d.ts +8 -2
- package/dist/models.js +84 -32
- package/dist/providers.d.ts +56 -0
- package/dist/providers.js +305 -0
- package/dist/quantization.d.ts +12 -0
- package/dist/quantization.js +54 -0
- package/dist/rag.d.ts +132 -7
- package/dist/rag.js +314 -38
- package/dist/repair.d.ts +1 -1
- package/dist/repair.js +53 -2
- package/dist/rerank.d.ts +51 -6
- package/dist/rerank.js +69 -10
- package/dist/search.d.ts +49 -3
- package/dist/search.js +387 -78
- package/dist/serve.d.ts +35 -0
- package/dist/serve.js +574 -58
- package/dist/tui.d.ts +14 -0
- package/dist/tui.js +132 -15
- package/dist/watcher.js +23 -12
- package/dist/webui.d.ts +3 -3
- package/dist/webui.js +225 -5
- package/dist/wikilinks.d.ts +31 -0
- package/dist/wikilinks.js +185 -1
- package/package.json +3 -3
- package/src/binary-format.ts +13 -0
- package/src/completions.ts +11 -1
- package/src/core.ts +249 -13
- package/src/federation.ts +51 -17
- package/src/filter.ts +14 -0
- package/src/hnsw.ts +414 -0
- package/src/index-format.ts +7 -1
- package/src/index.ts +7 -2
- package/src/indexer.ts +112 -19
- package/src/ivf.ts +157 -20
- package/src/lexical.ts +91 -13
- package/src/markdown-parser.ts +279 -37
- package/src/mcp.ts +820 -47
- package/src/models.ts +97 -35
- package/src/providers.ts +345 -0
- package/src/quantization.ts +61 -0
- package/src/rag.ts +451 -34
- package/src/repair.ts +51 -2
- package/src/rerank.ts +121 -14
- package/src/search.ts +424 -82
- package/src/serve.ts +589 -66
- package/src/tui.ts +142 -16
- package/src/watcher.ts +21 -10
- package/src/webui.ts +225 -5
- package/src/wikilinks.ts +220 -1
package/dist/serve.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import http from 'node:http';
|
|
7
7
|
import { ModelDescriptor } from './core.js';
|
|
8
|
+
import { createClientChannel } from './mcp.js';
|
|
9
|
+
import { ChatProviderId } from './providers.js';
|
|
8
10
|
declare const DEFAULT_PORT = 8747;
|
|
9
11
|
declare const DEFAULT_HOST = "127.0.0.1";
|
|
10
12
|
declare const WATCH_INTERVAL_MS = 3000;
|
|
@@ -29,11 +31,24 @@ export interface ServeState {
|
|
|
29
31
|
reindexCount?: number;
|
|
30
32
|
apiKey?: string;
|
|
31
33
|
healthPublic?: boolean;
|
|
34
|
+
/** issue #181: live count of open SSE /mcp streams (capped by maxConcurrency). */
|
|
35
|
+
sseConnections?: number;
|
|
32
36
|
/** issue #111: serve the built-in web UI at `/` (default on). */
|
|
33
37
|
ui?: boolean;
|
|
38
|
+
/** issue #199: chat endpoint backing POST /ask — absent → /ask returns 400. */
|
|
39
|
+
llmEndpoint?: string;
|
|
40
|
+
llmModel?: string;
|
|
41
|
+
llmProvider?: ChatProviderId;
|
|
42
|
+
systemPrompt?: string;
|
|
34
43
|
/** issue #123: mount the Streamable HTTP MCP transport at /mcp (default off). */
|
|
35
44
|
mcp?: boolean;
|
|
36
45
|
mcpSessionId?: string;
|
|
46
|
+
/** issue #197: reverse channel for server→client requests (MCP sampling). */
|
|
47
|
+
mcpChannel?: ReturnType<typeof createClientChannel>;
|
|
48
|
+
/** issue #197: capabilities the client declared at initialize. */
|
|
49
|
+
mcpClientCapabilities?: any;
|
|
50
|
+
/** issue #197: the open GET /mcp SSE stream doubling as the downlink (newest wins). */
|
|
51
|
+
mcpSseRes?: http.ServerResponse;
|
|
37
52
|
/** Extra Host-header values accepted beyond the loopback defaults (issue #120). */
|
|
38
53
|
allowedHosts?: string[];
|
|
39
54
|
/** Exact origins reflected as `Access-Control-Allow-Origin`; absent → CORS off (issue #120). */
|
|
@@ -64,11 +79,19 @@ export interface CreateServeOptions {
|
|
|
64
79
|
hash?: (absPath: string) => string;
|
|
65
80
|
stat?: (absPath: string) => {
|
|
66
81
|
mtimeMs: number;
|
|
82
|
+
size?: number;
|
|
67
83
|
};
|
|
68
84
|
};
|
|
69
85
|
ui?: boolean;
|
|
70
86
|
/** issue #123: mount Streamable HTTP MCP at /mcp (default off; stdio stays default). */
|
|
71
87
|
mcp?: boolean;
|
|
88
|
+
/** issue #202: chunk budget in tokens; default min(adapter.maxTokens, 512), 0 = legacy chars. */
|
|
89
|
+
maxChunkTokens?: number;
|
|
90
|
+
/** issue #199: chat endpoint for POST /ask SSE answer synthesis. */
|
|
91
|
+
llmEndpoint?: string;
|
|
92
|
+
llmModel?: string;
|
|
93
|
+
llmProvider?: ChatProviderId;
|
|
94
|
+
systemPrompt?: string;
|
|
72
95
|
embedFn?: any;
|
|
73
96
|
rerankFn?: any;
|
|
74
97
|
log?: (msg: string) => void;
|
|
@@ -172,4 +195,16 @@ export declare function loadApiKeyFile(filePath: string, log?: (msg: string) =>
|
|
|
172
195
|
* "localhost:8747" → "localhost", "[::1]:8747" → "[::1]", "::1" → "::1" (issue #120).
|
|
173
196
|
*/
|
|
174
197
|
export declare function splitHostHeader(hostHeader: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* Cross-site POST guard (issue #178). Browsers fire "simple" POSTs without
|
|
200
|
+
* preflight (Content-Type: text/plain, form encodings) from any open page;
|
|
201
|
+
* the loopback Host check alone does not stop them. A POST counts as
|
|
202
|
+
* same-site when:
|
|
203
|
+
* - the client sent no Origin/Sec-Fetch headers (curl, MCP and other
|
|
204
|
+
* non-browser clients), or
|
|
205
|
+
* - Sec-Fetch-Site is not cross-site AND the Origin's host matches the
|
|
206
|
+
* request Host, a loopback allowlist entry, or an explicit --cors-origin.
|
|
207
|
+
* `Origin: null` (sandboxed iframe, file:// page) is always rejected.
|
|
208
|
+
*/
|
|
209
|
+
export declare function isSameSitePost(req: http.IncomingMessage, allowedHosts: Set<string>, corsOrigins?: string[]): boolean;
|
|
175
210
|
export { DEFAULT_PORT, DEFAULT_HOST, MAX_BODY_BYTES, WATCH_INTERVAL_MS };
|