@cerebriline/core 4.100.243 → 4.100.245
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/dist/extensions/tools/code-search.d.ts +55 -0
- package/dist/extensions/tools/definitions.d.ts +2 -2
- package/dist/extensions/tools/index.d.ts +1 -1
- package/dist/extensions/tools/types.d.ts +15 -0
- package/dist/hub/daemon/entry.js +314 -314
- package/dist/hub/index.js +298 -298
- package/dist/index.d.ts +2 -0
- package/dist/index.js +645 -641
- package/dist/services/retrieval/code-index.d.ts +115 -0
- package/package.json +4 -4
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search a workspace's code by meaning.
|
|
3
|
+
*
|
|
4
|
+
* `search_codebase` is a regex: it finds a name the model already knows.
|
|
5
|
+
* `ask_lsp` resolves a symbol the model already has. Neither answers "where
|
|
6
|
+
* does this app check a user's password" when no word of the question is in
|
|
7
|
+
* the code. An embedding model does, and the Library already has everything
|
|
8
|
+
* that needs: chunking, a keyword index, vectors, the merge of the two and a
|
|
9
|
+
* reranker.
|
|
10
|
+
*
|
|
11
|
+
* So the code index is a second Library, kept apart from the user's books
|
|
12
|
+
* under `<data dir>/code-index`, with one collection per workspace and one
|
|
13
|
+
* document per source file. Nothing here knows about embeddings beyond what
|
|
14
|
+
* it hands on.
|
|
15
|
+
*
|
|
16
|
+
* It is opt-in per workspace: indexing sends every source file to the
|
|
17
|
+
* embedder, which on a large repository is real work for a GPU.
|
|
18
|
+
*/
|
|
19
|
+
import { type LibrarySettings } from "@cerebriline/shared";
|
|
20
|
+
import type { RetrievalEndpoint } from "./embedding-client";
|
|
21
|
+
import { type EmbedPendingResult, Library } from "./library";
|
|
22
|
+
import type { RetrieveResult } from "./retrieve";
|
|
23
|
+
export declare function resolveCodeIndexDirectory(): string;
|
|
24
|
+
/** A source file larger than this is a data file or a bundle, not code to search. */
|
|
25
|
+
export declare const CODE_INDEX_MAX_FILE_BYTES: number;
|
|
26
|
+
/** Files indexed per workspace, at most. Past it the rest is left out and said so. */
|
|
27
|
+
export declare const CODE_INDEX_MAX_FILES = 20000;
|
|
28
|
+
export declare function isIndexableCodePath(relativePath: string): boolean;
|
|
29
|
+
export interface CodeIndexOptions {
|
|
30
|
+
/** @default <data dir>/code-index */
|
|
31
|
+
directory?: string;
|
|
32
|
+
/** Where LanceDB is installed. @default the Library's */
|
|
33
|
+
runtimeDirectory?: string;
|
|
34
|
+
fetch?: typeof fetch;
|
|
35
|
+
}
|
|
36
|
+
export interface CodeSyncOptions {
|
|
37
|
+
settings?: LibrarySettings;
|
|
38
|
+
/** The workspace's files, relative with forward slashes. @default ripgrep's list, which honours .gitignore */
|
|
39
|
+
listFiles?: (root: string) => Promise<Iterable<string>>;
|
|
40
|
+
onProgress?: (done: number, total: number) => void;
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
}
|
|
43
|
+
export interface CodeSyncResult {
|
|
44
|
+
/** Files in the index after the run. */
|
|
45
|
+
files: number;
|
|
46
|
+
added: number;
|
|
47
|
+
updated: number;
|
|
48
|
+
removed: number;
|
|
49
|
+
/** Files left out: too large, binary, generated, or unreadable. */
|
|
50
|
+
skipped: number;
|
|
51
|
+
/** Set when the workspace has more files than are indexed. */
|
|
52
|
+
truncated?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface CodeEmbedOptions {
|
|
55
|
+
embedding: RetrievalEndpoint;
|
|
56
|
+
settings?: LibrarySettings;
|
|
57
|
+
/** Download LanceDB when it is not installed. */
|
|
58
|
+
install?: boolean;
|
|
59
|
+
onProgress?: (documentsDone: number, documents: number) => void;
|
|
60
|
+
signal?: AbortSignal;
|
|
61
|
+
}
|
|
62
|
+
export interface CodeSearchOptions {
|
|
63
|
+
settings?: LibrarySettings;
|
|
64
|
+
embedding?: RetrievalEndpoint;
|
|
65
|
+
reranker?: RetrievalEndpoint;
|
|
66
|
+
/** Passages returned. @default 8 */
|
|
67
|
+
limit?: number;
|
|
68
|
+
signal?: AbortSignal;
|
|
69
|
+
}
|
|
70
|
+
export interface CodeHit {
|
|
71
|
+
/** Relative to the workspace, forward slashes. */
|
|
72
|
+
path: string;
|
|
73
|
+
/** 1-based, inclusive. Absent when the file has changed since it was indexed. */
|
|
74
|
+
startLine?: number;
|
|
75
|
+
endLine?: number;
|
|
76
|
+
text: string;
|
|
77
|
+
rerankScore?: number;
|
|
78
|
+
similarity?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface CodeSearchResult {
|
|
81
|
+
hits: CodeHit[];
|
|
82
|
+
mode: RetrieveResult["mode"];
|
|
83
|
+
reranked: boolean;
|
|
84
|
+
notes: string[];
|
|
85
|
+
}
|
|
86
|
+
export interface CodeIndexStatus {
|
|
87
|
+
indexed: boolean;
|
|
88
|
+
files: number;
|
|
89
|
+
chunks: number;
|
|
90
|
+
}
|
|
91
|
+
/** One name for a workspace however its path was spelled. */
|
|
92
|
+
export declare function codeCollectionName(root: string): string;
|
|
93
|
+
export declare class CodeIndex {
|
|
94
|
+
readonly library: Library;
|
|
95
|
+
constructor(options?: CodeIndexOptions);
|
|
96
|
+
private collection;
|
|
97
|
+
status(root: string): CodeIndexStatus;
|
|
98
|
+
/**
|
|
99
|
+
* Bring the index in line with the files on disk: new and changed files
|
|
100
|
+
* are read and chunked, files that are gone are dropped. A file whose size
|
|
101
|
+
* and modification time are what they were is not read again.
|
|
102
|
+
*
|
|
103
|
+
* Searchable by keyword when this returns; `embed` adds the vectors.
|
|
104
|
+
*/
|
|
105
|
+
sync(root: string, options?: CodeSyncOptions): Promise<CodeSyncResult>;
|
|
106
|
+
/** Give vectors to every indexed file that has none for this embedding model. */
|
|
107
|
+
embed(root: string, options: CodeEmbedOptions): Promise<EmbedPendingResult>;
|
|
108
|
+
search(root: string, query: string, options?: CodeSearchOptions): Promise<CodeSearchResult>;
|
|
109
|
+
/** Forget a workspace: its files, chunks and vectors. */
|
|
110
|
+
remove(root: string): Promise<boolean>;
|
|
111
|
+
close(): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
/** The code index of the data folder, opened once. */
|
|
114
|
+
export declare function sharedCodeIndex(): CodeIndex;
|
|
115
|
+
export declare function closeSharedCodeIndex(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerebriline/core",
|
|
3
3
|
"description": "Cerebriline Core SDK for Node Runtime",
|
|
4
|
-
"version": "4.100.
|
|
4
|
+
"version": "4.100.245",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/mann1x/cline.git",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"ws": "^8.20.0",
|
|
70
70
|
"yaml": "^2.8.2",
|
|
71
71
|
"zod": "^4.3.6",
|
|
72
|
-
"@cerebriline/agents": "4.100.
|
|
73
|
-
"@cerebriline/llms": "4.100.
|
|
74
|
-
"@cerebriline/shared": "4.100.
|
|
72
|
+
"@cerebriline/agents": "4.100.245",
|
|
73
|
+
"@cerebriline/llms": "4.100.245",
|
|
74
|
+
"@cerebriline/shared": "4.100.245"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"posthog-node": "^5.8.0"
|