searchsocket 0.2.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 +848 -0
- package/dist/cli.js +3860 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.cjs +36 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +11 -0
- package/dist/client.d.ts +11 -0
- package/dist/client.js +34 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +20767 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +119 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +20742 -0
- package/dist/index.js.map +1 -0
- package/dist/sveltekit.cjs +20578 -0
- package/dist/sveltekit.cjs.map +1 -0
- package/dist/sveltekit.d.cts +37 -0
- package/dist/sveltekit.d.ts +37 -0
- package/dist/sveltekit.js +20563 -0
- package/dist/sveltekit.js.map +1 -0
- package/dist/types-D1K46vwd.d.cts +403 -0
- package/dist/types-D1K46vwd.d.ts +403 -0
- package/package.json +86 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { R as ResolvedSearchSocketConfig, b as SearchSocketConfig, c as Scope, E as EmbeddingsProvider, d as Reranker, e as RerankCandidate, V as VectorStore, I as IndexOptions, f as IndexStats, S as SearchRequest, a as SearchResponse } from './types-D1K46vwd.cjs';
|
|
2
|
+
export { C as Chunk, Q as QueryOpts, g as VectorHit, h as VectorRecord } from './types-D1K46vwd.cjs';
|
|
3
|
+
export { searchsocketHandle, searchsocketVitePlugin } from './sveltekit.cjs';
|
|
4
|
+
export { createSearchClient } from './client.cjs';
|
|
5
|
+
|
|
6
|
+
interface LoadConfigOptions {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
configPath?: string;
|
|
9
|
+
allowMissing?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function mergeConfig(cwd: string, rawConfig: SearchSocketConfig): ResolvedSearchSocketConfig;
|
|
12
|
+
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedSearchSocketConfig>;
|
|
13
|
+
|
|
14
|
+
declare function resolveScope(config: ResolvedSearchSocketConfig, override?: string): Scope;
|
|
15
|
+
|
|
16
|
+
declare function createEmbeddingsProvider(config: ResolvedSearchSocketConfig): EmbeddingsProvider;
|
|
17
|
+
|
|
18
|
+
interface JinaRerankerOptions {
|
|
19
|
+
apiKey: string;
|
|
20
|
+
model: string;
|
|
21
|
+
maxRetries?: number;
|
|
22
|
+
}
|
|
23
|
+
declare class JinaReranker implements Reranker {
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly model;
|
|
26
|
+
private readonly maxRetries;
|
|
27
|
+
constructor(options: JinaRerankerOptions);
|
|
28
|
+
rerank(query: string, candidates: RerankCandidate[], topN?: number): Promise<Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
score: number;
|
|
31
|
+
}>>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare function createReranker(config: ResolvedSearchSocketConfig): Reranker | null;
|
|
35
|
+
|
|
36
|
+
interface LoggerOptions {
|
|
37
|
+
json?: boolean;
|
|
38
|
+
verbose?: boolean;
|
|
39
|
+
/** When true, all output (including info/event) is written to stderr instead of stdout. */
|
|
40
|
+
stderrOnly?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare class Logger {
|
|
43
|
+
private readonly json;
|
|
44
|
+
private readonly verbose;
|
|
45
|
+
private readonly stderrOnly;
|
|
46
|
+
constructor(opts?: LoggerOptions);
|
|
47
|
+
info(message: string): void;
|
|
48
|
+
debug(message: string): void;
|
|
49
|
+
warn(message: string): void;
|
|
50
|
+
error(message: string): void;
|
|
51
|
+
event(event: string, data?: Record<string, unknown>): void;
|
|
52
|
+
private writeOut;
|
|
53
|
+
private logJson;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface IndexPipelineOptions {
|
|
57
|
+
cwd?: string;
|
|
58
|
+
configPath?: string;
|
|
59
|
+
config?: ResolvedSearchSocketConfig;
|
|
60
|
+
embeddingsProvider?: EmbeddingsProvider;
|
|
61
|
+
vectorStore?: VectorStore;
|
|
62
|
+
logger?: Logger;
|
|
63
|
+
}
|
|
64
|
+
declare class IndexPipeline {
|
|
65
|
+
private readonly cwd;
|
|
66
|
+
private readonly config;
|
|
67
|
+
private readonly embeddings;
|
|
68
|
+
private readonly vectorStore;
|
|
69
|
+
private readonly logger;
|
|
70
|
+
private constructor();
|
|
71
|
+
static create(options?: IndexPipelineOptions): Promise<IndexPipeline>;
|
|
72
|
+
getConfig(): ResolvedSearchSocketConfig;
|
|
73
|
+
run(rawOptions?: IndexOptions): Promise<IndexStats>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface SearchEngineOptions {
|
|
77
|
+
cwd?: string;
|
|
78
|
+
configPath?: string;
|
|
79
|
+
config?: ResolvedSearchSocketConfig;
|
|
80
|
+
embeddingsProvider?: EmbeddingsProvider;
|
|
81
|
+
vectorStore?: VectorStore;
|
|
82
|
+
reranker?: Reranker | null;
|
|
83
|
+
}
|
|
84
|
+
declare class SearchEngine {
|
|
85
|
+
private readonly cwd;
|
|
86
|
+
private readonly config;
|
|
87
|
+
private readonly embeddings;
|
|
88
|
+
private readonly vectorStore;
|
|
89
|
+
private readonly reranker;
|
|
90
|
+
private constructor();
|
|
91
|
+
static create(options?: SearchEngineOptions): Promise<SearchEngine>;
|
|
92
|
+
getConfig(): ResolvedSearchSocketConfig;
|
|
93
|
+
search(request: SearchRequest): Promise<SearchResponse>;
|
|
94
|
+
getPage(pathOrUrl: string, scope?: string): Promise<{
|
|
95
|
+
url: string;
|
|
96
|
+
frontmatter: Record<string, unknown>;
|
|
97
|
+
markdown: string;
|
|
98
|
+
}>;
|
|
99
|
+
health(): Promise<{
|
|
100
|
+
ok: boolean;
|
|
101
|
+
details?: string;
|
|
102
|
+
}>;
|
|
103
|
+
private resolveInputPath;
|
|
104
|
+
private assertModelCompatibility;
|
|
105
|
+
private rerankHits;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare function createVectorStore(config: ResolvedSearchSocketConfig, cwd: string): Promise<VectorStore>;
|
|
109
|
+
|
|
110
|
+
interface McpServerOptions {
|
|
111
|
+
cwd?: string;
|
|
112
|
+
configPath?: string;
|
|
113
|
+
transport?: "stdio" | "http";
|
|
114
|
+
httpPort?: number;
|
|
115
|
+
httpPath?: string;
|
|
116
|
+
}
|
|
117
|
+
declare function runMcpServer(options?: McpServerOptions): Promise<void>;
|
|
118
|
+
|
|
119
|
+
export { EmbeddingsProvider, IndexOptions, IndexPipeline, IndexStats, JinaReranker, RerankCandidate, Reranker, ResolvedSearchSocketConfig, Scope, SearchEngine, SearchRequest, SearchResponse, SearchSocketConfig, VectorStore, createEmbeddingsProvider, createReranker, createVectorStore, loadConfig, mergeConfig, resolveScope, runMcpServer };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { R as ResolvedSearchSocketConfig, b as SearchSocketConfig, c as Scope, E as EmbeddingsProvider, d as Reranker, e as RerankCandidate, V as VectorStore, I as IndexOptions, f as IndexStats, S as SearchRequest, a as SearchResponse } from './types-D1K46vwd.js';
|
|
2
|
+
export { C as Chunk, Q as QueryOpts, g as VectorHit, h as VectorRecord } from './types-D1K46vwd.js';
|
|
3
|
+
export { searchsocketHandle, searchsocketVitePlugin } from './sveltekit.js';
|
|
4
|
+
export { createSearchClient } from './client.js';
|
|
5
|
+
|
|
6
|
+
interface LoadConfigOptions {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
configPath?: string;
|
|
9
|
+
allowMissing?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function mergeConfig(cwd: string, rawConfig: SearchSocketConfig): ResolvedSearchSocketConfig;
|
|
12
|
+
declare function loadConfig(options?: LoadConfigOptions): Promise<ResolvedSearchSocketConfig>;
|
|
13
|
+
|
|
14
|
+
declare function resolveScope(config: ResolvedSearchSocketConfig, override?: string): Scope;
|
|
15
|
+
|
|
16
|
+
declare function createEmbeddingsProvider(config: ResolvedSearchSocketConfig): EmbeddingsProvider;
|
|
17
|
+
|
|
18
|
+
interface JinaRerankerOptions {
|
|
19
|
+
apiKey: string;
|
|
20
|
+
model: string;
|
|
21
|
+
maxRetries?: number;
|
|
22
|
+
}
|
|
23
|
+
declare class JinaReranker implements Reranker {
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly model;
|
|
26
|
+
private readonly maxRetries;
|
|
27
|
+
constructor(options: JinaRerankerOptions);
|
|
28
|
+
rerank(query: string, candidates: RerankCandidate[], topN?: number): Promise<Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
score: number;
|
|
31
|
+
}>>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare function createReranker(config: ResolvedSearchSocketConfig): Reranker | null;
|
|
35
|
+
|
|
36
|
+
interface LoggerOptions {
|
|
37
|
+
json?: boolean;
|
|
38
|
+
verbose?: boolean;
|
|
39
|
+
/** When true, all output (including info/event) is written to stderr instead of stdout. */
|
|
40
|
+
stderrOnly?: boolean;
|
|
41
|
+
}
|
|
42
|
+
declare class Logger {
|
|
43
|
+
private readonly json;
|
|
44
|
+
private readonly verbose;
|
|
45
|
+
private readonly stderrOnly;
|
|
46
|
+
constructor(opts?: LoggerOptions);
|
|
47
|
+
info(message: string): void;
|
|
48
|
+
debug(message: string): void;
|
|
49
|
+
warn(message: string): void;
|
|
50
|
+
error(message: string): void;
|
|
51
|
+
event(event: string, data?: Record<string, unknown>): void;
|
|
52
|
+
private writeOut;
|
|
53
|
+
private logJson;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface IndexPipelineOptions {
|
|
57
|
+
cwd?: string;
|
|
58
|
+
configPath?: string;
|
|
59
|
+
config?: ResolvedSearchSocketConfig;
|
|
60
|
+
embeddingsProvider?: EmbeddingsProvider;
|
|
61
|
+
vectorStore?: VectorStore;
|
|
62
|
+
logger?: Logger;
|
|
63
|
+
}
|
|
64
|
+
declare class IndexPipeline {
|
|
65
|
+
private readonly cwd;
|
|
66
|
+
private readonly config;
|
|
67
|
+
private readonly embeddings;
|
|
68
|
+
private readonly vectorStore;
|
|
69
|
+
private readonly logger;
|
|
70
|
+
private constructor();
|
|
71
|
+
static create(options?: IndexPipelineOptions): Promise<IndexPipeline>;
|
|
72
|
+
getConfig(): ResolvedSearchSocketConfig;
|
|
73
|
+
run(rawOptions?: IndexOptions): Promise<IndexStats>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface SearchEngineOptions {
|
|
77
|
+
cwd?: string;
|
|
78
|
+
configPath?: string;
|
|
79
|
+
config?: ResolvedSearchSocketConfig;
|
|
80
|
+
embeddingsProvider?: EmbeddingsProvider;
|
|
81
|
+
vectorStore?: VectorStore;
|
|
82
|
+
reranker?: Reranker | null;
|
|
83
|
+
}
|
|
84
|
+
declare class SearchEngine {
|
|
85
|
+
private readonly cwd;
|
|
86
|
+
private readonly config;
|
|
87
|
+
private readonly embeddings;
|
|
88
|
+
private readonly vectorStore;
|
|
89
|
+
private readonly reranker;
|
|
90
|
+
private constructor();
|
|
91
|
+
static create(options?: SearchEngineOptions): Promise<SearchEngine>;
|
|
92
|
+
getConfig(): ResolvedSearchSocketConfig;
|
|
93
|
+
search(request: SearchRequest): Promise<SearchResponse>;
|
|
94
|
+
getPage(pathOrUrl: string, scope?: string): Promise<{
|
|
95
|
+
url: string;
|
|
96
|
+
frontmatter: Record<string, unknown>;
|
|
97
|
+
markdown: string;
|
|
98
|
+
}>;
|
|
99
|
+
health(): Promise<{
|
|
100
|
+
ok: boolean;
|
|
101
|
+
details?: string;
|
|
102
|
+
}>;
|
|
103
|
+
private resolveInputPath;
|
|
104
|
+
private assertModelCompatibility;
|
|
105
|
+
private rerankHits;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare function createVectorStore(config: ResolvedSearchSocketConfig, cwd: string): Promise<VectorStore>;
|
|
109
|
+
|
|
110
|
+
interface McpServerOptions {
|
|
111
|
+
cwd?: string;
|
|
112
|
+
configPath?: string;
|
|
113
|
+
transport?: "stdio" | "http";
|
|
114
|
+
httpPort?: number;
|
|
115
|
+
httpPath?: string;
|
|
116
|
+
}
|
|
117
|
+
declare function runMcpServer(options?: McpServerOptions): Promise<void>;
|
|
118
|
+
|
|
119
|
+
export { EmbeddingsProvider, IndexOptions, IndexPipeline, IndexStats, JinaReranker, RerankCandidate, Reranker, ResolvedSearchSocketConfig, Scope, SearchEngine, SearchRequest, SearchResponse, SearchSocketConfig, VectorStore, createEmbeddingsProvider, createReranker, createVectorStore, loadConfig, mergeConfig, resolveScope, runMcpServer };
|