opencode-rag-plugin 2.10.1 → 2.11.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 +40 -28
- package/dist/api.js +1 -0
- package/dist/cli/commands/clickhouse.d.ts +61 -0
- package/dist/cli/commands/clickhouse.js +335 -0
- package/dist/cli/commands/eval-tuner.js +1 -1
- package/dist/cli/commands/eval.js +1 -1
- package/dist/cli/commands/index-command.js +2 -1
- package/dist/cli/commands/index.d.ts +1 -0
- package/dist/cli/commands/index.js +1 -0
- package/dist/cli/commands/init-helpers.js +2 -2
- package/dist/cli/commands/init.js +49 -11
- package/dist/cli/commands/quirk.js +6 -6
- package/dist/cli/commands/status.js +70 -6
- package/dist/cli/commands/ui.js +2 -2
- package/dist/cli/index.js +2 -1
- package/dist/cli/types.d.ts +14 -0
- package/dist/core/bootstrap.d.ts +7 -0
- package/dist/core/bootstrap.js +40 -9
- package/dist/core/config.d.ts +128 -5
- package/dist/core/config.js +205 -8
- package/dist/core/interfaces.d.ts +54 -0
- package/dist/core/runtime-overrides.d.ts +9 -0
- package/dist/core/runtime-overrides.js +44 -0
- package/dist/core/state-sync.d.ts +91 -0
- package/dist/core/state-sync.js +273 -0
- package/dist/eval/fast-index.js +2 -2
- package/dist/eval/rerank-eval.js +2 -2
- package/dist/eval/run-branch-compare.js +2 -2
- package/dist/eval/run-token-test.js +2 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -1
- package/dist/indexer/pipeline.d.ts +6 -0
- package/dist/indexer/pipeline.js +173 -56
- package/dist/indexer/progress.d.ts +75 -0
- package/dist/indexer/progress.js +114 -0
- package/dist/indexer/stats.d.ts +14 -0
- package/dist/plugin.d.ts +6 -3
- package/dist/plugin.js +39 -20
- package/dist/quirks/quirk-store.d.ts +10 -0
- package/dist/quirks/quirk-store.js +110 -15
- package/dist/quirks/types.d.ts +7 -0
- package/dist/tui.js +128 -111
- package/dist/vectorstore/clickhouse.d.ts +150 -0
- package/dist/vectorstore/clickhouse.js +931 -0
- package/dist/vectorstore/dimension.d.ts +19 -0
- package/dist/vectorstore/dimension.js +36 -0
- package/dist/vectorstore/factory.d.ts +9 -3
- package/dist/vectorstore/factory.js +11 -2
- package/dist/vectorstore/lancedb.d.ts +2 -2
- package/dist/watcher.d.ts +29 -0
- package/dist/watcher.js +76 -2
- package/dist/web/api.d.ts +3 -4
- package/dist/web/api.js +18 -3
- package/dist/web/server.js +28 -2
- package/dist/web/ui/assets/index-B-RH6fko.css +2 -0
- package/dist/web/ui/index.html +2 -2
- package/package.json +2 -1
- package/dist/web/ui/assets/index-CWcp0jNf.css +0 -2
- /package/dist/web/ui/assets/{index-DbXFrn53.js → index-ChGi2bSp.js} +0 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Durable workspace-state synchronisation.
|
|
3
|
+
*
|
|
4
|
+
* ClickHouse is the source of truth when `vectorStore.provider` is
|
|
5
|
+
* `"clickhouse"`: the manifest, keyword index, quirks, runtime overrides and
|
|
6
|
+
* documentation progress live in the project's `state_<namespace>` table, and
|
|
7
|
+
* the local `vectorStore.path` directory is a disposable cache. That is what
|
|
8
|
+
* makes a fresh clone on another machine able to search and incrementally
|
|
9
|
+
* index without re-embedding anything.
|
|
10
|
+
*
|
|
11
|
+
* For LanceDB (and memory) this class is a no-op — the local directory remains
|
|
12
|
+
* the source of truth, exactly as before.
|
|
13
|
+
*
|
|
14
|
+
* Conflict rules (no cross-machine clock assumptions):
|
|
15
|
+
* - If local content already equals remote content: nothing to do.
|
|
16
|
+
* - If local content is unchanged since the last sync (hash matches the
|
|
17
|
+
* record): remote wins.
|
|
18
|
+
* - If local content changed: quirks are merged by id (later `lastObserved`
|
|
19
|
+
* wins), everything else keeps the local copy and uploads it.
|
|
20
|
+
*/
|
|
21
|
+
import { createHash } from "node:crypto";
|
|
22
|
+
import fs from "node:fs/promises";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
/** State names and their local cache files. */
|
|
25
|
+
const STATE_FILES = {
|
|
26
|
+
manifest: { file: "manifest.json", required: true },
|
|
27
|
+
"keyword-index": { file: "keyword-index.json", required: false },
|
|
28
|
+
quirks: { file: "quirks.jsonl", required: false, merge: true },
|
|
29
|
+
"runtime-overrides": { file: "runtime-overrides.json", required: false },
|
|
30
|
+
"doc-progress": { file: "doc-progress.json", required: false },
|
|
31
|
+
".desc-cache": { file: ".desc-cache.json", required: false, cache: true },
|
|
32
|
+
};
|
|
33
|
+
const VERSIONS_FILE = ".state-sync.json";
|
|
34
|
+
/** SHA-256 hex of a string or buffer. */
|
|
35
|
+
function sha256(data) {
|
|
36
|
+
return createHash("sha256").update(data).digest("hex");
|
|
37
|
+
}
|
|
38
|
+
/** Atomic file write (temp + rename), tolerating Windows rename semantics. */
|
|
39
|
+
async function writeFileAtomic(filePath, data) {
|
|
40
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
41
|
+
const tempPath = `${filePath}.tmp`;
|
|
42
|
+
await fs.writeFile(tempPath, data, "utf-8");
|
|
43
|
+
try {
|
|
44
|
+
await fs.rename(tempPath, filePath);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
await fs.unlink(filePath).catch(() => { });
|
|
48
|
+
await fs.rename(tempPath, filePath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function readFileOrUndefined(filePath) {
|
|
52
|
+
try {
|
|
53
|
+
return await fs.readFile(filePath, "utf-8");
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Merge two JSONL quirk logs by id, keeping the record with the later
|
|
61
|
+
* `lastObserved` (falling back to the later `updatedAt`, then the local copy).
|
|
62
|
+
*
|
|
63
|
+
* A record carrying `deletedAt` is a deletion tombstone: it is final. A live
|
|
64
|
+
* record never overrides a tombstone (quirk ids are never reused, so any live
|
|
65
|
+
* copy of a deleted id is stale), which is what makes the union propagate a
|
|
66
|
+
* deletion instead of resurrecting it.
|
|
67
|
+
*
|
|
68
|
+
* Output is sorted by id so identical inputs hash identically.
|
|
69
|
+
*/
|
|
70
|
+
export function mergeQuirkJsonl(local, remote) {
|
|
71
|
+
const byId = new Map();
|
|
72
|
+
const isDeleted = (record) => typeof record.deletedAt === "string" && record.deletedAt.length > 0;
|
|
73
|
+
const timestamp = (record) => {
|
|
74
|
+
for (const key of ["lastObserved", "updatedAt", "timestamp", "createdAt"]) {
|
|
75
|
+
const value = record[key];
|
|
76
|
+
if (typeof value === "string") {
|
|
77
|
+
const parsed = Date.parse(value);
|
|
78
|
+
if (Number.isFinite(parsed))
|
|
79
|
+
return parsed;
|
|
80
|
+
}
|
|
81
|
+
if (typeof value === "number")
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
return 0;
|
|
85
|
+
};
|
|
86
|
+
const ingest = (raw) => {
|
|
87
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
88
|
+
const trimmed = line.trim();
|
|
89
|
+
if (!trimmed)
|
|
90
|
+
continue;
|
|
91
|
+
try {
|
|
92
|
+
const record = JSON.parse(trimmed);
|
|
93
|
+
const id = typeof record.id === "string" ? record.id : undefined;
|
|
94
|
+
if (!id)
|
|
95
|
+
continue;
|
|
96
|
+
const existing = byId.get(id);
|
|
97
|
+
if (!existing) {
|
|
98
|
+
byId.set(id, record);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
// A tombstone is final: quirk ids are never reused, so any live copy of
|
|
102
|
+
// a deleted id is stale and must not resurrect it, whatever its clock.
|
|
103
|
+
if (isDeleted(record) && !isDeleted(existing)) {
|
|
104
|
+
byId.set(id, record);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (isDeleted(existing) && !isDeleted(record))
|
|
108
|
+
continue;
|
|
109
|
+
// Otherwise the later timestamp wins; `>=` keeps the original tie-break
|
|
110
|
+
// (local is ingested second, so the local copy wins an equal timestamp).
|
|
111
|
+
if (timestamp(record) >= timestamp(existing)) {
|
|
112
|
+
byId.set(id, record);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Ignore a malformed line: the other side's copy of that id wins.
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
ingest(remote);
|
|
121
|
+
ingest(local);
|
|
122
|
+
return Array.from(byId.entries())
|
|
123
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
124
|
+
.map(([, record]) => JSON.stringify(record))
|
|
125
|
+
.join("\n") + (byId.size > 0 ? "\n" : "");
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Synchronise the durable workspace state with a central store.
|
|
129
|
+
*
|
|
130
|
+
* Inactive (a no-op) for every provider except `"clickhouse"`.
|
|
131
|
+
*/
|
|
132
|
+
export class StateSync {
|
|
133
|
+
storePath;
|
|
134
|
+
enabled;
|
|
135
|
+
syncDescCache;
|
|
136
|
+
warn;
|
|
137
|
+
remote;
|
|
138
|
+
constructor(options) {
|
|
139
|
+
this.storePath = options.storePath;
|
|
140
|
+
this.warn = options.warn ?? ((message) => console.warn(message));
|
|
141
|
+
this.enabled = (options.config.vectorStore.provider ?? "lancedb") === "clickhouse";
|
|
142
|
+
this.syncDescCache = options.config.vectorStore.clickhouse?.state?.syncDescCache ?? false;
|
|
143
|
+
const candidate = options.store;
|
|
144
|
+
this.remote =
|
|
145
|
+
typeof candidate.readState === "function" && typeof candidate.writeState === "function"
|
|
146
|
+
? candidate
|
|
147
|
+
: undefined;
|
|
148
|
+
}
|
|
149
|
+
/** True when this instance actually talks to a central state table. */
|
|
150
|
+
get active() {
|
|
151
|
+
return this.enabled && this.remote !== undefined;
|
|
152
|
+
}
|
|
153
|
+
entries() {
|
|
154
|
+
return Object.entries(STATE_FILES)
|
|
155
|
+
.filter(([, spec]) => !("cache" in spec && spec.cache) || this.syncDescCache);
|
|
156
|
+
}
|
|
157
|
+
versionsPath() {
|
|
158
|
+
return path.join(this.storePath, VERSIONS_FILE);
|
|
159
|
+
}
|
|
160
|
+
async loadVersions() {
|
|
161
|
+
const raw = await readFileOrUndefined(this.versionsPath());
|
|
162
|
+
if (!raw)
|
|
163
|
+
return {};
|
|
164
|
+
try {
|
|
165
|
+
return JSON.parse(raw);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async saveVersions(versions) {
|
|
172
|
+
await writeFileAtomic(this.versionsPath(), JSON.stringify(versions, null, 2));
|
|
173
|
+
}
|
|
174
|
+
localPath(name) {
|
|
175
|
+
return path.join(this.storePath, STATE_FILES[name].file);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Pull durable state into the local cache. Call before anything reads the
|
|
179
|
+
* manifest/keyword index/quirks (bootstrap does this).
|
|
180
|
+
*/
|
|
181
|
+
async hydrate() {
|
|
182
|
+
if (!this.active)
|
|
183
|
+
return;
|
|
184
|
+
const versions = await this.loadVersions();
|
|
185
|
+
const mergedNames = [];
|
|
186
|
+
for (const [name, spec] of this.entries()) {
|
|
187
|
+
let remote;
|
|
188
|
+
try {
|
|
189
|
+
remote = await this.remote.readState(name);
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
this.warn(`[state-sync] Could not read "${name}" from ClickHouse: ${err.message}`);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (!remote?.data)
|
|
196
|
+
continue;
|
|
197
|
+
const local = await readFileOrUndefined(this.localPath(name));
|
|
198
|
+
const remoteHash = sha256(remote.data);
|
|
199
|
+
if (local !== undefined && sha256(local) === remoteHash) {
|
|
200
|
+
versions[name] = { sha256: remoteHash };
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const record = versions[name];
|
|
204
|
+
const localClean = local === undefined || record?.sha256 === sha256(local);
|
|
205
|
+
if (localClean) {
|
|
206
|
+
await writeFileAtomic(this.localPath(name), remote.data);
|
|
207
|
+
versions[name] = { sha256: remoteHash };
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if ("merge" in spec && spec.merge) {
|
|
211
|
+
const merged = mergeQuirkJsonl(local, remote.data);
|
|
212
|
+
await writeFileAtomic(this.localPath(name), merged);
|
|
213
|
+
// Do NOT record the merged hash here: `flush` must upload it first.
|
|
214
|
+
// Recording it would make flush believe the merged payload was already
|
|
215
|
+
// sent, leaving the remote row stale (and the next hydrate would then
|
|
216
|
+
// "restore" the stale remote over the newer local file).
|
|
217
|
+
mergedNames.push(name);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
// Both sides changed and this file cannot be merged: keep the local
|
|
221
|
+
// copy (it reflects this machine's latest work). The next index pass
|
|
222
|
+
// will upload it; a read command must not write to the central store.
|
|
223
|
+
this.warn(`[state-sync] "${name}" changed locally and remotely — keeping the local copy (uploaded on the next index pass).`);
|
|
224
|
+
}
|
|
225
|
+
await this.saveVersions(versions);
|
|
226
|
+
if (mergedNames.length > 0) {
|
|
227
|
+
await this.flush(mergedNames, versions);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Upload changed state files. No-op names are ignored.
|
|
232
|
+
*
|
|
233
|
+
* @param names - State names to flush; defaults to every syncable file.
|
|
234
|
+
* @param existingVersions - Reuse a versions map already loaded by `hydrate`.
|
|
235
|
+
*/
|
|
236
|
+
async flush(names, existingVersions) {
|
|
237
|
+
if (!this.active)
|
|
238
|
+
return;
|
|
239
|
+
const versions = existingVersions ?? (await this.loadVersions());
|
|
240
|
+
const targets = names ?? this.entries().map(([name]) => name);
|
|
241
|
+
for (const name of targets) {
|
|
242
|
+
const spec = STATE_FILES[name];
|
|
243
|
+
const local = await readFileOrUndefined(this.localPath(name));
|
|
244
|
+
if (local === undefined)
|
|
245
|
+
continue;
|
|
246
|
+
let payload = local;
|
|
247
|
+
if ("merge" in spec && spec.merge) {
|
|
248
|
+
try {
|
|
249
|
+
const remote = await this.remote.readState(name);
|
|
250
|
+
if (remote?.data)
|
|
251
|
+
payload = mergeQuirkJsonl(local, remote.data);
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
// Upload the local copy; the next hydrate merges instead.
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const hash = sha256(payload);
|
|
258
|
+
if (versions[name]?.sha256 === hash)
|
|
259
|
+
continue;
|
|
260
|
+
try {
|
|
261
|
+
await this.remote.writeState(name, payload, hash);
|
|
262
|
+
if (payload !== local)
|
|
263
|
+
await writeFileAtomic(this.localPath(name), payload);
|
|
264
|
+
versions[name] = { sha256: hash };
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
this.warn(`[state-sync] Could not upload "${name}": ${err.message}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
await this.saveVersions(versions);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=state-sync.js.map
|
package/dist/eval/fast-index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { readFileSync, readdirSync } from "node:fs";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
|
-
import { loadConfig, DEFAULT_CONFIG } from "../core/config.js";
|
|
11
|
+
import { loadConfig, findConfigFile, DEFAULT_CONFIG } from "../core/config.js";
|
|
12
12
|
import { createEmbedder } from "../embedder/factory.js";
|
|
13
13
|
import { createVectorStore } from "../vectorstore/factory.js";
|
|
14
14
|
import { loadRuntimeOverrides, applyRuntimeOverrides, } from "../core/runtime-overrides.js";
|
|
@@ -105,7 +105,7 @@ function parseArgs() {
|
|
|
105
105
|
return { descriptionsPath, force };
|
|
106
106
|
}
|
|
107
107
|
function getConfig() {
|
|
108
|
-
const configPath = path.join(WORKTREE, "opencode-rag.json");
|
|
108
|
+
const configPath = findConfigFile(WORKTREE) ?? path.join(WORKTREE, "opencode-rag.json");
|
|
109
109
|
let cfg;
|
|
110
110
|
try {
|
|
111
111
|
cfg = loadConfig(configPath);
|
package/dist/eval/rerank-eval.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
*/
|
|
45
45
|
import { existsSync, writeFileSync } from "node:fs";
|
|
46
46
|
import path from "node:path";
|
|
47
|
-
import { DEFAULT_CONFIG, loadConfig } from "../core/config.js";
|
|
47
|
+
import { DEFAULT_CONFIG, loadConfig, findConfigFile } from "../core/config.js";
|
|
48
48
|
import { createEmbedder } from "../embedder/factory.js";
|
|
49
49
|
import { createVectorStore } from "../vectorstore/factory.js";
|
|
50
50
|
import { readStoreDimension } from "../vectorstore/lancedb.js";
|
|
@@ -54,7 +54,7 @@ import { applyRuntimeOverrides, loadRuntimeOverrides } from "../core/runtime-ove
|
|
|
54
54
|
import { resolveApiKey } from "../core/resolve-api-key.js";
|
|
55
55
|
import { evaluateGoldenResults, loadGoldenLabels, summarizeGoldenOutcomes, } from "./golden-set.js";
|
|
56
56
|
const WORKTREE = process.cwd();
|
|
57
|
-
const CONFIG_PATH = path.join(WORKTREE, "opencode-rag.json");
|
|
57
|
+
const CONFIG_PATH = findConfigFile(WORKTREE) ?? path.join(WORKTREE, "opencode-rag.json");
|
|
58
58
|
const STORE_PATH = path.join(WORKTREE, ".opencode", "rag_db");
|
|
59
59
|
const DEFAULT_LABELS_PATH = path.join(WORKTREE, "src", "eval", "rerank-labels.json");
|
|
60
60
|
const DEFAULT_REPORT_PATH = path.join(WORKTREE, "doc", "rerank-eval-report.md");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { writeFileSync } from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
-
import { loadConfig, DEFAULT_CONFIG } from "../core/config.js";
|
|
9
|
+
import { loadConfig, findConfigFile, DEFAULT_CONFIG } from "../core/config.js";
|
|
10
10
|
import { createEmbedder } from "../embedder/factory.js";
|
|
11
11
|
import { createVectorStore } from "../vectorstore/factory.js";
|
|
12
12
|
import { retrieve } from "../retriever/retriever.js";
|
|
@@ -72,7 +72,7 @@ function getGitInfo() {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
function getConfig() {
|
|
75
|
-
const configPath = path.join(WORKTREE, "opencode-rag.json");
|
|
75
|
+
const configPath = findConfigFile(WORKTREE) ?? path.join(WORKTREE, "opencode-rag.json");
|
|
76
76
|
let cfg;
|
|
77
77
|
try {
|
|
78
78
|
cfg = loadConfig(configPath);
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { writeFileSync } from "node:fs";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import { loadConfig, DEFAULT_CONFIG } from "../core/config.js";
|
|
12
|
+
import { loadConfig, findConfigFile, DEFAULT_CONFIG } from "../core/config.js";
|
|
13
13
|
import { createEmbedder } from "../embedder/factory.js";
|
|
14
14
|
import { createVectorStore } from "../vectorstore/factory.js";
|
|
15
15
|
import { retrieve } from "../retriever/retriever.js";
|
|
@@ -33,7 +33,7 @@ const QUERIES = [
|
|
|
33
33
|
"How does the session logger capture token usage?",
|
|
34
34
|
];
|
|
35
35
|
function getConfig() {
|
|
36
|
-
const configPath = path.join(WORKTREE, "opencode-rag.json");
|
|
36
|
+
const configPath = findConfigFile(WORKTREE) ?? path.join(WORKTREE, "opencode-rag.json");
|
|
37
37
|
let cfg;
|
|
38
38
|
try {
|
|
39
39
|
cfg = loadConfig(configPath);
|
package/dist/index.d.ts
CHANGED
|
@@ -16,15 +16,18 @@ export { formatDecisionAnswers } from "./decision/format.js";
|
|
|
16
16
|
export { createVectorStore } from "./vectorstore/factory.js";
|
|
17
17
|
export { LanceDbStore } from "./vectorstore/lancedb.js";
|
|
18
18
|
export { InMemoryVectorStore } from "./vectorstore/memory.js";
|
|
19
|
+
export { ClickHouseStore, resolveClickHouseOptions, sanitizeNamespace, deriveNamespace } from "./vectorstore/clickhouse.js";
|
|
20
|
+
export type { ResolvedClickHouseOptions } from "./vectorstore/clickhouse.js";
|
|
19
21
|
export { retrieve } from "./retriever/retriever.js";
|
|
20
22
|
export { optimizeContext, DEFAULT_CONTEXT_OPTIMIZATION } from "./retriever/context-optimizer.js";
|
|
21
23
|
export { loadConfig, loadConfigLayers, loadWorkspaceConfig, resolveConfigPaths, configuredSections, findGlobalConfigFile, globalConfigPath, DEFAULT_CONFIG } from "./core/config.js";
|
|
22
|
-
export { createBackgroundIndexer } from "./watcher.js";
|
|
24
|
+
export { createBackgroundIndexer, deriveWatcherHealth, readWatcherState, discoverWatcherStates } from "./watcher.js";
|
|
25
|
+
export type { WatcherStatus, ObservedWatcher } from "./watcher.js";
|
|
23
26
|
export { createWatchIgnore } from "./indexer.js";
|
|
24
27
|
export { ImageChunker, createImageVisionProvider, resolveOnDemandImageConfig, getMimeType, SUPPORTED_IMAGE_EXTENSIONS } from "./chunker/image.js";
|
|
25
28
|
export { DescriptionCache } from "./core/desc-cache.js";
|
|
26
29
|
export type { RagConfig, DescriptionConfig, ImageDescriptionConfig, ImageDescriptionOnDemandConfig, DecisionConfig } from "./core/config.js";
|
|
27
|
-
export type { Chunk, SearchResult, OptimizedSearchResult, Chunker, DescriptionProvider, EmbeddingProvider, VectorStore, DecisionProvider, DecisionQuestion, DecisionQuestionType, DecisionAnswer, DecisionRequest, DecisionResult } from "./core/interfaces.js";
|
|
30
|
+
export type { Chunk, SearchResult, OptimizedSearchResult, Chunker, DescriptionProvider, EmbeddingProvider, VectorStore, ChunkBrowseStore, DecisionProvider, DecisionQuestion, DecisionQuestionType, DecisionAnswer, DecisionRequest, DecisionResult } from "./core/interfaces.js";
|
|
28
31
|
export type { ContextOptimizationConfig, ContextOptimizationOptions } from "./retriever/context-optimizer.js";
|
|
29
32
|
/**
|
|
30
33
|
* High-level convenience API — search, index, and retrieve context in a single function call.
|
package/dist/index.js
CHANGED
|
@@ -15,10 +15,11 @@ export { formatDecisionAnswers } from "./decision/format.js";
|
|
|
15
15
|
export { createVectorStore } from "./vectorstore/factory.js";
|
|
16
16
|
export { LanceDbStore } from "./vectorstore/lancedb.js";
|
|
17
17
|
export { InMemoryVectorStore } from "./vectorstore/memory.js";
|
|
18
|
+
export { ClickHouseStore, resolveClickHouseOptions, sanitizeNamespace, deriveNamespace } from "./vectorstore/clickhouse.js";
|
|
18
19
|
export { retrieve } from "./retriever/retriever.js";
|
|
19
20
|
export { optimizeContext, DEFAULT_CONTEXT_OPTIMIZATION } from "./retriever/context-optimizer.js";
|
|
20
21
|
export { loadConfig, loadConfigLayers, loadWorkspaceConfig, resolveConfigPaths, configuredSections, findGlobalConfigFile, globalConfigPath, DEFAULT_CONFIG } from "./core/config.js";
|
|
21
|
-
export { createBackgroundIndexer } from "./watcher.js";
|
|
22
|
+
export { createBackgroundIndexer, deriveWatcherHealth, readWatcherState, discoverWatcherStates } from "./watcher.js";
|
|
22
23
|
export { createWatchIgnore } from "./indexer.js";
|
|
23
24
|
export { ImageChunker, createImageVisionProvider, resolveOnDemandImageConfig, getMimeType, SUPPORTED_IMAGE_EXTENSIONS } from "./chunker/image.js";
|
|
24
25
|
export { DescriptionCache } from "./core/desc-cache.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RagConfig } from "../core/config.js";
|
|
2
2
|
import type { DescriptionProvider, EmbeddingProvider, IndexProgress, KeywordIndex, VectorStore } from "../core/interfaces.js";
|
|
3
3
|
import type { ImageVisionProvider } from "../chunker/image.js";
|
|
4
|
+
import type { StateSync } from "../core/state-sync.js";
|
|
4
5
|
import { type IndexRunStats, type IndexStatusSummary } from "./stats.js";
|
|
5
6
|
export type { WatchPassScheduler } from "./watch.js";
|
|
6
7
|
export { createWatchPassScheduler, createWatchIgnore } from "./watch.js";
|
|
@@ -35,6 +36,11 @@ export interface RunIndexPassOptions {
|
|
|
35
36
|
* provider is created from the imageDescription config as usual.
|
|
36
37
|
*/
|
|
37
38
|
imageVisionProvider?: ImageVisionProvider;
|
|
39
|
+
/**
|
|
40
|
+
* Durable-state synchronizer. When present (ClickHouse), the manifest,
|
|
41
|
+
* keyword index and quirk log are uploaded at the end of the pass.
|
|
42
|
+
*/
|
|
43
|
+
stateSync?: StateSync;
|
|
38
44
|
}
|
|
39
45
|
/** Minimal logger interface for indexing pipeline diagnostics. */
|
|
40
46
|
export interface Logger {
|