searchsocket 0.3.3 → 0.5.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 +57 -39
- package/dist/cli.js +947 -1378
- package/dist/client.cjs +45 -0
- package/dist/client.d.cts +3 -2
- package/dist/client.d.ts +3 -2
- package/dist/client.js +45 -1
- package/dist/index.cjs +909 -1286
- package/dist/index.d.cts +73 -33
- package/dist/index.d.ts +73 -33
- package/dist/index.js +906 -1281
- package/dist/plugin-B_npJSux.d.cts +36 -0
- package/dist/plugin-M-aW0ev6.d.ts +36 -0
- package/dist/scroll.cjs +185 -0
- package/dist/scroll.d.cts +42 -0
- package/dist/scroll.d.ts +42 -0
- package/dist/scroll.js +183 -0
- package/dist/sveltekit.cjs +997 -1204
- package/dist/sveltekit.d.cts +3 -43
- package/dist/sveltekit.d.ts +3 -43
- package/dist/sveltekit.js +995 -1202
- package/dist/{types-BrG6XTUU.d.cts → types-Dk43uz25.d.cts} +50 -109
- package/dist/{types-BrG6XTUU.d.ts → types-Dk43uz25.d.ts} +50 -109
- package/package.json +10 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { R as ResolvedSearchSocketConfig,
|
|
2
|
-
export { C as Chunk
|
|
3
|
-
|
|
1
|
+
import { R as ResolvedSearchSocketConfig, c as SearchSocketConfig, d as Scope, V as VectorHit, P as PageHit, e as ScopeInfo, f as PageRecord, I as IndexOptions, g as IndexStats, S as SearchRequest, a as SearchResponse } from './types-Dk43uz25.cjs';
|
|
2
|
+
export { C as Chunk } from './types-Dk43uz25.cjs';
|
|
3
|
+
import { Search } from '@upstash/search';
|
|
4
|
+
export { s as searchsocketHandle, b as searchsocketVitePlugin } from './plugin-B_npJSux.cjs';
|
|
4
5
|
export { createSearchClient } from './client.cjs';
|
|
5
6
|
|
|
6
7
|
interface LoadConfigOptions {
|
|
@@ -28,26 +29,71 @@ declare function isServerless(): boolean;
|
|
|
28
29
|
|
|
29
30
|
declare function resolveScope(config: ResolvedSearchSocketConfig, override?: string): Scope;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/** Content fields stored in Upstash Search (indexed and searchable) */
|
|
33
|
+
interface ChunkContent {
|
|
34
|
+
title: string;
|
|
35
|
+
sectionTitle: string;
|
|
36
|
+
text: string;
|
|
37
|
+
url: string;
|
|
38
|
+
tags: string;
|
|
39
|
+
headingPath: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/** Metadata fields stored in Upstash Search (returned but not searchable) */
|
|
43
|
+
interface ChunkMetadata {
|
|
44
|
+
projectId: string;
|
|
45
|
+
scopeName: string;
|
|
46
|
+
path: string;
|
|
47
|
+
snippet: string;
|
|
48
|
+
ordinal: number;
|
|
49
|
+
contentHash: string;
|
|
50
|
+
depth: number;
|
|
51
|
+
incomingLinks: number;
|
|
52
|
+
routeFile: string;
|
|
53
|
+
description: string;
|
|
54
|
+
keywords: string;
|
|
55
|
+
[key: string]: unknown;
|
|
37
56
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
interface UpstashSearchStoreOptions {
|
|
58
|
+
client: Search;
|
|
59
|
+
}
|
|
60
|
+
declare class UpstashSearchStore {
|
|
61
|
+
private readonly client;
|
|
62
|
+
constructor(opts: UpstashSearchStoreOptions);
|
|
63
|
+
private chunkIndex;
|
|
64
|
+
private pageIndex;
|
|
65
|
+
upsertChunks(chunks: Array<{
|
|
44
66
|
id: string;
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
content: ChunkContent;
|
|
68
|
+
metadata: ChunkMetadata;
|
|
69
|
+
}>, scope: Scope): Promise<void>;
|
|
70
|
+
search(query: string, opts: {
|
|
71
|
+
limit: number;
|
|
72
|
+
semanticWeight?: number;
|
|
73
|
+
inputEnrichment?: boolean;
|
|
74
|
+
reranking?: boolean;
|
|
75
|
+
filter?: string;
|
|
76
|
+
}, scope: Scope): Promise<VectorHit[]>;
|
|
77
|
+
searchPages(query: string, opts: {
|
|
78
|
+
limit: number;
|
|
79
|
+
semanticWeight?: number;
|
|
80
|
+
inputEnrichment?: boolean;
|
|
81
|
+
filter?: string;
|
|
82
|
+
}, scope: Scope): Promise<PageHit[]>;
|
|
83
|
+
deleteByIds(ids: string[], scope: Scope): Promise<void>;
|
|
84
|
+
deleteScope(scope: Scope): Promise<void>;
|
|
85
|
+
listScopes(projectId: string): Promise<ScopeInfo[]>;
|
|
86
|
+
getContentHashes(scope: Scope): Promise<Map<string, string>>;
|
|
87
|
+
upsertPages(pages: PageRecord[], scope: Scope): Promise<void>;
|
|
88
|
+
getPage(url: string, scope: Scope): Promise<PageRecord | null>;
|
|
89
|
+
deletePages(scope: Scope): Promise<void>;
|
|
90
|
+
health(): Promise<{
|
|
91
|
+
ok: boolean;
|
|
92
|
+
details?: string;
|
|
93
|
+
}>;
|
|
94
|
+
dropAllIndexes(projectId: string): Promise<void>;
|
|
47
95
|
}
|
|
48
96
|
|
|
49
|
-
declare function createReranker(config: ResolvedSearchSocketConfig): Reranker | null;
|
|
50
|
-
|
|
51
97
|
interface LoggerOptions {
|
|
52
98
|
json?: boolean;
|
|
53
99
|
verbose?: boolean;
|
|
@@ -74,15 +120,13 @@ interface IndexPipelineOptions {
|
|
|
74
120
|
cwd?: string;
|
|
75
121
|
configPath?: string;
|
|
76
122
|
config?: ResolvedSearchSocketConfig;
|
|
77
|
-
|
|
78
|
-
vectorStore?: VectorStore;
|
|
123
|
+
store?: UpstashSearchStore;
|
|
79
124
|
logger?: Logger;
|
|
80
125
|
}
|
|
81
126
|
declare class IndexPipeline {
|
|
82
127
|
private readonly cwd;
|
|
83
128
|
private readonly config;
|
|
84
|
-
private readonly
|
|
85
|
-
private readonly vectorStore;
|
|
129
|
+
private readonly store;
|
|
86
130
|
private readonly logger;
|
|
87
131
|
private constructor();
|
|
88
132
|
static create(options?: IndexPipelineOptions): Promise<IndexPipeline>;
|
|
@@ -94,20 +138,18 @@ interface SearchEngineOptions {
|
|
|
94
138
|
cwd?: string;
|
|
95
139
|
configPath?: string;
|
|
96
140
|
config?: ResolvedSearchSocketConfig;
|
|
97
|
-
|
|
98
|
-
vectorStore?: VectorStore;
|
|
99
|
-
reranker?: Reranker | null;
|
|
141
|
+
store?: UpstashSearchStore;
|
|
100
142
|
}
|
|
101
143
|
declare class SearchEngine {
|
|
102
144
|
private readonly cwd;
|
|
103
145
|
private readonly config;
|
|
104
|
-
private readonly
|
|
105
|
-
private readonly vectorStore;
|
|
106
|
-
private readonly reranker;
|
|
146
|
+
private readonly store;
|
|
107
147
|
private constructor();
|
|
108
148
|
static create(options?: SearchEngineOptions): Promise<SearchEngine>;
|
|
109
149
|
getConfig(): ResolvedSearchSocketConfig;
|
|
110
150
|
search(request: SearchRequest): Promise<SearchResponse>;
|
|
151
|
+
private ensureSnippet;
|
|
152
|
+
private buildResults;
|
|
111
153
|
getPage(pathOrUrl: string, scope?: string): Promise<{
|
|
112
154
|
url: string;
|
|
113
155
|
frontmatter: Record<string, unknown>;
|
|
@@ -118,11 +160,9 @@ declare class SearchEngine {
|
|
|
118
160
|
details?: string;
|
|
119
161
|
}>;
|
|
120
162
|
private resolveInputPath;
|
|
121
|
-
private assertModelCompatibility;
|
|
122
|
-
private rerankHits;
|
|
123
163
|
}
|
|
124
164
|
|
|
125
|
-
declare function
|
|
165
|
+
declare function createUpstashStore(config: ResolvedSearchSocketConfig): Promise<UpstashSearchStore>;
|
|
126
166
|
|
|
127
167
|
interface McpServerOptions {
|
|
128
168
|
cwd?: string;
|
|
@@ -133,4 +173,4 @@ interface McpServerOptions {
|
|
|
133
173
|
}
|
|
134
174
|
declare function runMcpServer(options?: McpServerOptions): Promise<void>;
|
|
135
175
|
|
|
136
|
-
export {
|
|
176
|
+
export { IndexOptions, IndexPipeline, IndexStats, ResolvedSearchSocketConfig, Scope, SearchEngine, SearchRequest, SearchResponse, SearchSocketConfig, UpstashSearchStore, VectorHit, createUpstashStore, isServerless, loadConfig, mergeConfig, mergeConfigServerless, resolveScope, runMcpServer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { R as ResolvedSearchSocketConfig,
|
|
2
|
-
export { C as Chunk
|
|
3
|
-
|
|
1
|
+
import { R as ResolvedSearchSocketConfig, c as SearchSocketConfig, d as Scope, V as VectorHit, P as PageHit, e as ScopeInfo, f as PageRecord, I as IndexOptions, g as IndexStats, S as SearchRequest, a as SearchResponse } from './types-Dk43uz25.js';
|
|
2
|
+
export { C as Chunk } from './types-Dk43uz25.js';
|
|
3
|
+
import { Search } from '@upstash/search';
|
|
4
|
+
export { s as searchsocketHandle, b as searchsocketVitePlugin } from './plugin-M-aW0ev6.js';
|
|
4
5
|
export { createSearchClient } from './client.js';
|
|
5
6
|
|
|
6
7
|
interface LoadConfigOptions {
|
|
@@ -28,26 +29,71 @@ declare function isServerless(): boolean;
|
|
|
28
29
|
|
|
29
30
|
declare function resolveScope(config: ResolvedSearchSocketConfig, override?: string): Scope;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/** Content fields stored in Upstash Search (indexed and searchable) */
|
|
33
|
+
interface ChunkContent {
|
|
34
|
+
title: string;
|
|
35
|
+
sectionTitle: string;
|
|
36
|
+
text: string;
|
|
37
|
+
url: string;
|
|
38
|
+
tags: string;
|
|
39
|
+
headingPath: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/** Metadata fields stored in Upstash Search (returned but not searchable) */
|
|
43
|
+
interface ChunkMetadata {
|
|
44
|
+
projectId: string;
|
|
45
|
+
scopeName: string;
|
|
46
|
+
path: string;
|
|
47
|
+
snippet: string;
|
|
48
|
+
ordinal: number;
|
|
49
|
+
contentHash: string;
|
|
50
|
+
depth: number;
|
|
51
|
+
incomingLinks: number;
|
|
52
|
+
routeFile: string;
|
|
53
|
+
description: string;
|
|
54
|
+
keywords: string;
|
|
55
|
+
[key: string]: unknown;
|
|
37
56
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
interface UpstashSearchStoreOptions {
|
|
58
|
+
client: Search;
|
|
59
|
+
}
|
|
60
|
+
declare class UpstashSearchStore {
|
|
61
|
+
private readonly client;
|
|
62
|
+
constructor(opts: UpstashSearchStoreOptions);
|
|
63
|
+
private chunkIndex;
|
|
64
|
+
private pageIndex;
|
|
65
|
+
upsertChunks(chunks: Array<{
|
|
44
66
|
id: string;
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
content: ChunkContent;
|
|
68
|
+
metadata: ChunkMetadata;
|
|
69
|
+
}>, scope: Scope): Promise<void>;
|
|
70
|
+
search(query: string, opts: {
|
|
71
|
+
limit: number;
|
|
72
|
+
semanticWeight?: number;
|
|
73
|
+
inputEnrichment?: boolean;
|
|
74
|
+
reranking?: boolean;
|
|
75
|
+
filter?: string;
|
|
76
|
+
}, scope: Scope): Promise<VectorHit[]>;
|
|
77
|
+
searchPages(query: string, opts: {
|
|
78
|
+
limit: number;
|
|
79
|
+
semanticWeight?: number;
|
|
80
|
+
inputEnrichment?: boolean;
|
|
81
|
+
filter?: string;
|
|
82
|
+
}, scope: Scope): Promise<PageHit[]>;
|
|
83
|
+
deleteByIds(ids: string[], scope: Scope): Promise<void>;
|
|
84
|
+
deleteScope(scope: Scope): Promise<void>;
|
|
85
|
+
listScopes(projectId: string): Promise<ScopeInfo[]>;
|
|
86
|
+
getContentHashes(scope: Scope): Promise<Map<string, string>>;
|
|
87
|
+
upsertPages(pages: PageRecord[], scope: Scope): Promise<void>;
|
|
88
|
+
getPage(url: string, scope: Scope): Promise<PageRecord | null>;
|
|
89
|
+
deletePages(scope: Scope): Promise<void>;
|
|
90
|
+
health(): Promise<{
|
|
91
|
+
ok: boolean;
|
|
92
|
+
details?: string;
|
|
93
|
+
}>;
|
|
94
|
+
dropAllIndexes(projectId: string): Promise<void>;
|
|
47
95
|
}
|
|
48
96
|
|
|
49
|
-
declare function createReranker(config: ResolvedSearchSocketConfig): Reranker | null;
|
|
50
|
-
|
|
51
97
|
interface LoggerOptions {
|
|
52
98
|
json?: boolean;
|
|
53
99
|
verbose?: boolean;
|
|
@@ -74,15 +120,13 @@ interface IndexPipelineOptions {
|
|
|
74
120
|
cwd?: string;
|
|
75
121
|
configPath?: string;
|
|
76
122
|
config?: ResolvedSearchSocketConfig;
|
|
77
|
-
|
|
78
|
-
vectorStore?: VectorStore;
|
|
123
|
+
store?: UpstashSearchStore;
|
|
79
124
|
logger?: Logger;
|
|
80
125
|
}
|
|
81
126
|
declare class IndexPipeline {
|
|
82
127
|
private readonly cwd;
|
|
83
128
|
private readonly config;
|
|
84
|
-
private readonly
|
|
85
|
-
private readonly vectorStore;
|
|
129
|
+
private readonly store;
|
|
86
130
|
private readonly logger;
|
|
87
131
|
private constructor();
|
|
88
132
|
static create(options?: IndexPipelineOptions): Promise<IndexPipeline>;
|
|
@@ -94,20 +138,18 @@ interface SearchEngineOptions {
|
|
|
94
138
|
cwd?: string;
|
|
95
139
|
configPath?: string;
|
|
96
140
|
config?: ResolvedSearchSocketConfig;
|
|
97
|
-
|
|
98
|
-
vectorStore?: VectorStore;
|
|
99
|
-
reranker?: Reranker | null;
|
|
141
|
+
store?: UpstashSearchStore;
|
|
100
142
|
}
|
|
101
143
|
declare class SearchEngine {
|
|
102
144
|
private readonly cwd;
|
|
103
145
|
private readonly config;
|
|
104
|
-
private readonly
|
|
105
|
-
private readonly vectorStore;
|
|
106
|
-
private readonly reranker;
|
|
146
|
+
private readonly store;
|
|
107
147
|
private constructor();
|
|
108
148
|
static create(options?: SearchEngineOptions): Promise<SearchEngine>;
|
|
109
149
|
getConfig(): ResolvedSearchSocketConfig;
|
|
110
150
|
search(request: SearchRequest): Promise<SearchResponse>;
|
|
151
|
+
private ensureSnippet;
|
|
152
|
+
private buildResults;
|
|
111
153
|
getPage(pathOrUrl: string, scope?: string): Promise<{
|
|
112
154
|
url: string;
|
|
113
155
|
frontmatter: Record<string, unknown>;
|
|
@@ -118,11 +160,9 @@ declare class SearchEngine {
|
|
|
118
160
|
details?: string;
|
|
119
161
|
}>;
|
|
120
162
|
private resolveInputPath;
|
|
121
|
-
private assertModelCompatibility;
|
|
122
|
-
private rerankHits;
|
|
123
163
|
}
|
|
124
164
|
|
|
125
|
-
declare function
|
|
165
|
+
declare function createUpstashStore(config: ResolvedSearchSocketConfig): Promise<UpstashSearchStore>;
|
|
126
166
|
|
|
127
167
|
interface McpServerOptions {
|
|
128
168
|
cwd?: string;
|
|
@@ -133,4 +173,4 @@ interface McpServerOptions {
|
|
|
133
173
|
}
|
|
134
174
|
declare function runMcpServer(options?: McpServerOptions): Promise<void>;
|
|
135
175
|
|
|
136
|
-
export {
|
|
176
|
+
export { IndexOptions, IndexPipeline, IndexStats, ResolvedSearchSocketConfig, Scope, SearchEngine, SearchRequest, SearchResponse, SearchSocketConfig, UpstashSearchStore, VectorHit, createUpstashStore, isServerless, loadConfig, mergeConfig, mergeConfigServerless, resolveScope, runMcpServer };
|