ragcode-context-engine 0.1.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/LICENSE +21 -0
- package/README.md +366 -0
- package/README.zh-CN.md +363 -0
- package/dist/src/cli/configure/app.d.ts +6 -0
- package/dist/src/cli/configure/app.js +81 -0
- package/dist/src/cli/configure/run.d.ts +5 -0
- package/dist/src/cli/configure/run.js +85 -0
- package/dist/src/cli/configure/state.d.ts +42 -0
- package/dist/src/cli/configure/state.js +174 -0
- package/dist/src/cli/configure.d.ts +31 -0
- package/dist/src/cli/configure.js +101 -0
- package/dist/src/cli/index.d.ts +2 -0
- package/dist/src/cli/index.js +503 -0
- package/dist/src/cli/tui/index-progress.d.ts +12 -0
- package/dist/src/cli/tui/index-progress.js +49 -0
- package/dist/src/cli/tui/watch-status.d.ts +10 -0
- package/dist/src/cli/tui/watch-status.js +27 -0
- package/dist/src/cli/update.d.ts +18 -0
- package/dist/src/cli/update.js +111 -0
- package/dist/src/config/dotenv.d.ts +1 -0
- package/dist/src/config/dotenv.js +14 -0
- package/dist/src/config/graph-runtime.d.ts +13 -0
- package/dist/src/config/graph-runtime.js +29 -0
- package/dist/src/config/runtime-config.d.ts +87 -0
- package/dist/src/config/runtime-config.js +215 -0
- package/dist/src/config/semantic-runtime.d.ts +24 -0
- package/dist/src/config/semantic-runtime.js +89 -0
- package/dist/src/context/context-builder.d.ts +20 -0
- package/dist/src/context/context-builder.js +277 -0
- package/dist/src/context/expansion-policy.d.ts +6 -0
- package/dist/src/context/expansion-policy.js +49 -0
- package/dist/src/context/skeletonizer.d.ts +2 -0
- package/dist/src/context/skeletonizer.js +79 -0
- package/dist/src/context/snippet-renderer.d.ts +2 -0
- package/dist/src/context/snippet-renderer.js +67 -0
- package/dist/src/core/contracts.d.ts +74 -0
- package/dist/src/core/contracts.js +1 -0
- package/dist/src/core/engine.d.ts +64 -0
- package/dist/src/core/engine.js +442 -0
- package/dist/src/core/types.d.ts +490 -0
- package/dist/src/core/types.js +1 -0
- package/dist/src/diagnostics/doctor.d.ts +66 -0
- package/dist/src/diagnostics/doctor.js +193 -0
- package/dist/src/diagnostics/embedding-test.d.ts +24 -0
- package/dist/src/diagnostics/embedding-test.js +83 -0
- package/dist/src/graph/diff-files.d.ts +1 -0
- package/dist/src/graph/diff-files.js +14 -0
- package/dist/src/graph/impact-report.d.ts +10 -0
- package/dist/src/graph/impact-report.js +173 -0
- package/dist/src/graph/in-memory-graph-store.d.ts +36 -0
- package/dist/src/graph/in-memory-graph-store.js +395 -0
- package/dist/src/graph/owner-ranking.d.ts +2 -0
- package/dist/src/graph/owner-ranking.js +41 -0
- package/dist/src/graph/sqlite-graph-store.d.ts +51 -0
- package/dist/src/graph/sqlite-graph-store.js +724 -0
- package/dist/src/graph/sqlite-statements.d.ts +36 -0
- package/dist/src/graph/sqlite-statements.js +105 -0
- package/dist/src/graph/target-matcher.d.ts +13 -0
- package/dist/src/graph/target-matcher.js +64 -0
- package/dist/src/index.d.ts +32 -0
- package/dist/src/index.js +32 -0
- package/dist/src/indexing/analyzers/fallback-analyzer.d.ts +6 -0
- package/dist/src/indexing/analyzers/fallback-analyzer.js +45 -0
- package/dist/src/indexing/analyzers/go-treesitter-analyzer.d.ts +2 -0
- package/dist/src/indexing/analyzers/go-treesitter-analyzer.js +87 -0
- package/dist/src/indexing/analyzers/java-treesitter-analyzer.d.ts +2 -0
- package/dist/src/indexing/analyzers/java-treesitter-analyzer.js +88 -0
- package/dist/src/indexing/analyzers/python-treesitter-analyzer.d.ts +2 -0
- package/dist/src/indexing/analyzers/python-treesitter-analyzer.js +96 -0
- package/dist/src/indexing/analyzers/registry.d.ts +5 -0
- package/dist/src/indexing/analyzers/registry.js +23 -0
- package/dist/src/indexing/analyzers/rust-treesitter-analyzer.d.ts +2 -0
- package/dist/src/indexing/analyzers/rust-treesitter-analyzer.js +96 -0
- package/dist/src/indexing/analyzers/tree-sitter-base.d.ts +30 -0
- package/dist/src/indexing/analyzers/tree-sitter-base.js +163 -0
- package/dist/src/indexing/analyzers/types.d.ts +17 -0
- package/dist/src/indexing/analyzers/types.js +1 -0
- package/dist/src/indexing/analyzers/typescript-analyzer.d.ts +5 -0
- package/dist/src/indexing/analyzers/typescript-analyzer.js +199 -0
- package/dist/src/indexing/ast-analyzer.d.ts +11 -0
- package/dist/src/indexing/ast-analyzer.js +11 -0
- package/dist/src/indexing/chunker.d.ts +11 -0
- package/dist/src/indexing/chunker.js +157 -0
- package/dist/src/indexing/ignore-policy.d.ts +6 -0
- package/dist/src/indexing/ignore-policy.js +40 -0
- package/dist/src/indexing/indexer.d.ts +13 -0
- package/dist/src/indexing/indexer.js +189 -0
- package/dist/src/indexing/language.d.ts +3 -0
- package/dist/src/indexing/language.js +24 -0
- package/dist/src/indexing/scanner.d.ts +13 -0
- package/dist/src/indexing/scanner.js +87 -0
- package/dist/src/lsp/definition-resolver.d.ts +6 -0
- package/dist/src/lsp/definition-resolver.js +60 -0
- package/dist/src/lsp/typescript-language-service.d.ts +21 -0
- package/dist/src/lsp/typescript-language-service.js +82 -0
- package/dist/src/mcp/server.d.ts +11 -0
- package/dist/src/mcp/server.js +64 -0
- package/dist/src/mcp/tools.d.ts +266 -0
- package/dist/src/mcp/tools.js +309 -0
- package/dist/src/project/project-identity.d.ts +2 -0
- package/dist/src/project/project-identity.js +24 -0
- package/dist/src/project/project-registry.d.ts +12 -0
- package/dist/src/project/project-registry.js +49 -0
- package/dist/src/project/workspace-resolver.d.ts +20 -0
- package/dist/src/project/workspace-resolver.js +62 -0
- package/dist/src/retrieval/graph-reranker.d.ts +11 -0
- package/dist/src/retrieval/graph-reranker.js +0 -0
- package/dist/src/retrieval/hybrid-retriever.d.ts +31 -0
- package/dist/src/retrieval/hybrid-retriever.js +111 -0
- package/dist/src/retrieval/path-classification.d.ts +6 -0
- package/dist/src/retrieval/path-classification.js +22 -0
- package/dist/src/retrieval/query-matching.d.ts +22 -0
- package/dist/src/retrieval/query-matching.js +166 -0
- package/dist/src/retrieval/query-planner.d.ts +5 -0
- package/dist/src/retrieval/query-planner.js +77 -0
- package/dist/src/retrieval/ranking-signals.d.ts +19 -0
- package/dist/src/retrieval/ranking-signals.js +97 -0
- package/dist/src/retrieval/topology-distance.d.ts +21 -0
- package/dist/src/retrieval/topology-distance.js +116 -0
- package/dist/src/reuse/reuse-detector.d.ts +12 -0
- package/dist/src/reuse/reuse-detector.js +564 -0
- package/dist/src/semantic/deterministic-embedding.d.ts +7 -0
- package/dist/src/semantic/deterministic-embedding.js +31 -0
- package/dist/src/semantic/in-memory-semantic-store.d.ts +11 -0
- package/dist/src/semantic/in-memory-semantic-store.js +65 -0
- package/dist/src/semantic/lance-semantic-store.d.ts +131 -0
- package/dist/src/semantic/lance-semantic-store.js +623 -0
- package/dist/src/semantic/openai-compatible-embedding.d.ts +19 -0
- package/dist/src/semantic/openai-compatible-embedding.js +75 -0
- package/dist/src/service/service-identity.d.ts +13 -0
- package/dist/src/service/service-identity.js +48 -0
- package/dist/src/service/service-manager.d.ts +29 -0
- package/dist/src/service/service-manager.js +231 -0
- package/dist/src/service/service-templates.d.ts +22 -0
- package/dist/src/service/service-templates.js +101 -0
- package/dist/src/subgraph/impact-explainer.d.ts +2 -0
- package/dist/src/subgraph/impact-explainer.js +54 -0
- package/dist/src/subgraph/node-expander.d.ts +13 -0
- package/dist/src/subgraph/node-expander.js +139 -0
- package/dist/src/subgraph/output-preset.d.ts +3 -0
- package/dist/src/subgraph/output-preset.js +102 -0
- package/dist/src/subgraph/subgraph-builder.d.ts +17 -0
- package/dist/src/subgraph/subgraph-builder.js +688 -0
- package/dist/src/topology/export-index.d.ts +7 -0
- package/dist/src/topology/export-index.js +14 -0
- package/dist/src/topology/framework-topology.d.ts +3 -0
- package/dist/src/topology/framework-topology.js +460 -0
- package/dist/src/topology/import-resolver.d.ts +2 -0
- package/dist/src/topology/import-resolver.js +29 -0
- package/dist/src/topology/orm-topology.d.ts +3 -0
- package/dist/src/topology/orm-topology.js +200 -0
- package/dist/src/topology/runtime-topology.d.ts +3 -0
- package/dist/src/topology/runtime-topology.js +204 -0
- package/dist/src/topology/symbol-resolver.d.ts +6 -0
- package/dist/src/topology/symbol-resolver.js +74 -0
- package/dist/src/topology/test-topology.d.ts +2 -0
- package/dist/src/topology/test-topology.js +82 -0
- package/dist/src/utils/hash.d.ts +2 -0
- package/dist/src/utils/hash.js +7 -0
- package/dist/src/utils/path.d.ts +2 -0
- package/dist/src/utils/path.js +7 -0
- package/dist/src/watch/event-journal.d.ts +17 -0
- package/dist/src/watch/event-journal.js +81 -0
- package/dist/src/watch/file-event-coalescer.d.ts +9 -0
- package/dist/src/watch/file-event-coalescer.js +39 -0
- package/dist/src/watch/index-scheduler.d.ts +52 -0
- package/dist/src/watch/index-scheduler.js +190 -0
- package/dist/src/watch/watch-daemon.d.ts +73 -0
- package/dist/src/watch/watch-daemon.js +368 -0
- package/dist/src/watch/watcher-liveness.d.ts +47 -0
- package/dist/src/watch/watcher-liveness.js +168 -0
- package/dist/src/web/server.d.ts +1 -0
- package/dist/src/web/server.js +375 -0
- package/package.json +94 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { EmbeddingProvider, SemanticStore } from "../core/contracts.js";
|
|
2
|
+
import type { CodeChunk, SearchHit, SearchQuery } from "../core/types.js";
|
|
3
|
+
export interface LanceTable {
|
|
4
|
+
add(rows: LanceChunkRecord[]): Promise<unknown>;
|
|
5
|
+
delete(predicate: string): Promise<unknown>;
|
|
6
|
+
schema?(): Promise<LanceTableSchema> | LanceTableSchema;
|
|
7
|
+
query?(): {
|
|
8
|
+
where(predicate: string): {
|
|
9
|
+
limit(limit: number): {
|
|
10
|
+
toArray(): Promise<LanceChunkRecord[]>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
search(vector: number[]): {
|
|
15
|
+
where(predicate: string): {
|
|
16
|
+
limit(limit: number): {
|
|
17
|
+
toArray(): Promise<Array<LanceChunkRecord & {
|
|
18
|
+
_distance?: number;
|
|
19
|
+
}>>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface LanceConnection {
|
|
25
|
+
tableNames(): Promise<string[]>;
|
|
26
|
+
openTable(name: string): Promise<LanceTable>;
|
|
27
|
+
createTable(name: string, rows: LanceChunkRecord[]): Promise<LanceTable>;
|
|
28
|
+
dropTable?(name: string): Promise<unknown>;
|
|
29
|
+
}
|
|
30
|
+
export interface LanceModule {
|
|
31
|
+
connect(uri: string): Promise<LanceConnection>;
|
|
32
|
+
}
|
|
33
|
+
export interface LanceChunkRecord {
|
|
34
|
+
id: string;
|
|
35
|
+
projectId: string;
|
|
36
|
+
repoRoot: string;
|
|
37
|
+
filePath: string;
|
|
38
|
+
language: string;
|
|
39
|
+
kind: string;
|
|
40
|
+
symbolName?: string;
|
|
41
|
+
startLine: number;
|
|
42
|
+
endLine: number;
|
|
43
|
+
content: string;
|
|
44
|
+
contentHash: string;
|
|
45
|
+
generation: number;
|
|
46
|
+
vector: number[];
|
|
47
|
+
}
|
|
48
|
+
export interface LanceTableSchema {
|
|
49
|
+
fields?: LanceSchemaField[];
|
|
50
|
+
}
|
|
51
|
+
export interface LanceSchemaField {
|
|
52
|
+
name?: string;
|
|
53
|
+
type?: unknown;
|
|
54
|
+
dataType?: unknown;
|
|
55
|
+
vectorDimensions?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface LanceSemanticStoreOptions {
|
|
58
|
+
tableName?: string;
|
|
59
|
+
connection?: LanceConnection;
|
|
60
|
+
module?: LanceModule;
|
|
61
|
+
vectorDimensions?: number;
|
|
62
|
+
embeddingProfile?: LanceEmbeddingProfileIdentity;
|
|
63
|
+
profileStore?: LanceProfileStore;
|
|
64
|
+
embeddingBatchSize?: number;
|
|
65
|
+
embeddingConcurrency?: number;
|
|
66
|
+
embeddingRetryAttempts?: number;
|
|
67
|
+
embeddingRetryBaseDelayMs?: number;
|
|
68
|
+
repairOnMismatch?: boolean;
|
|
69
|
+
maxChunks?: number;
|
|
70
|
+
onProgress?: (progress: LanceEmbeddingProgress) => void;
|
|
71
|
+
}
|
|
72
|
+
export interface LanceEmbeddingProgress {
|
|
73
|
+
totalChunks: number;
|
|
74
|
+
completedChunks: number;
|
|
75
|
+
batchChunks: number;
|
|
76
|
+
batchIndex: number;
|
|
77
|
+
batchCount: number;
|
|
78
|
+
elapsedMs: number;
|
|
79
|
+
}
|
|
80
|
+
export interface LanceEmbeddingProfileIdentity {
|
|
81
|
+
provider: string;
|
|
82
|
+
model?: string;
|
|
83
|
+
baseUrl?: string;
|
|
84
|
+
requestDimensions?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface LanceEmbeddingProfile extends LanceEmbeddingProfileIdentity {
|
|
87
|
+
schemaVersion: 1;
|
|
88
|
+
tableName: string;
|
|
89
|
+
dimensions: number;
|
|
90
|
+
createdAtMs: number;
|
|
91
|
+
updatedAtMs: number;
|
|
92
|
+
}
|
|
93
|
+
export interface LanceProfileStore {
|
|
94
|
+
read(): Promise<LanceEmbeddingProfile | undefined>;
|
|
95
|
+
write(profile: LanceEmbeddingProfile): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export declare class LanceSemanticStore implements SemanticStore {
|
|
98
|
+
private readonly uri;
|
|
99
|
+
private tablePromise?;
|
|
100
|
+
private readonly tableName;
|
|
101
|
+
private readonly connection?;
|
|
102
|
+
private readonly module?;
|
|
103
|
+
private readonly vectorDimensions?;
|
|
104
|
+
private readonly embeddingProfile;
|
|
105
|
+
private readonly profileStore;
|
|
106
|
+
private readonly embeddingBatchSize;
|
|
107
|
+
private readonly embeddingConcurrency;
|
|
108
|
+
private readonly embeddingRetryAttempts;
|
|
109
|
+
private readonly embeddingRetryBaseDelayMs;
|
|
110
|
+
private readonly repairOnMismatch;
|
|
111
|
+
private readonly maxChunks?;
|
|
112
|
+
private readonly onProgress?;
|
|
113
|
+
constructor(uri: string, tableNameOrOptions?: string | LanceSemanticStoreOptions);
|
|
114
|
+
needsRebuild(_repoRoot: string, _projectId: string): Promise<boolean>;
|
|
115
|
+
resetRepo(repoRoot: string): Promise<void>;
|
|
116
|
+
deleteFile(_repoRoot: string, projectId: string, filePath: string): Promise<void>;
|
|
117
|
+
upsertChunks(chunks: CodeChunk[], provider: EmbeddingProvider, generation?: number): Promise<void>;
|
|
118
|
+
private embedChunkBatch;
|
|
119
|
+
private deleteFileScopesForChunks;
|
|
120
|
+
private planChunkEmbeddings;
|
|
121
|
+
private loadReusableVectors;
|
|
122
|
+
search(query: SearchQuery, provider: EmbeddingProvider): Promise<SearchHit[]>;
|
|
123
|
+
private getTable;
|
|
124
|
+
private getExistingTable;
|
|
125
|
+
private addRows;
|
|
126
|
+
private openOrCreateTable;
|
|
127
|
+
private getConnection;
|
|
128
|
+
private ensureCompatibleProfile;
|
|
129
|
+
private dropTableForRepair;
|
|
130
|
+
private expectedProfile;
|
|
131
|
+
}
|