@soleri/core 2.0.1 → 2.0.2
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/brain/brain.d.ts +3 -12
- package/dist/brain/brain.d.ts.map +1 -1
- package/dist/brain/brain.js +13 -305
- package/dist/brain/brain.js.map +1 -1
- package/dist/curator/curator.d.ts +28 -0
- package/dist/curator/curator.d.ts.map +1 -0
- package/dist/curator/curator.js +523 -0
- package/dist/curator/curator.js.map +1 -0
- package/dist/curator/types.d.ts +87 -0
- package/dist/curator/types.d.ts.map +1 -0
- package/dist/curator/types.js +3 -0
- package/dist/curator/types.js.map +1 -0
- package/dist/facades/types.d.ts +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/llm/llm-client.d.ts +28 -0
- package/dist/llm/llm-client.d.ts.map +1 -0
- package/dist/llm/llm-client.js +219 -0
- package/dist/llm/llm-client.js.map +1 -0
- package/dist/runtime/core-ops.d.ts +17 -0
- package/dist/runtime/core-ops.d.ts.map +1 -0
- package/dist/runtime/core-ops.js +448 -0
- package/dist/runtime/core-ops.js.map +1 -0
- package/dist/runtime/domain-ops.d.ts +25 -0
- package/dist/runtime/domain-ops.d.ts.map +1 -0
- package/dist/runtime/domain-ops.js +130 -0
- package/dist/runtime/domain-ops.js.map +1 -0
- package/dist/runtime/runtime.d.ts +19 -0
- package/dist/runtime/runtime.d.ts.map +1 -0
- package/dist/runtime/runtime.js +62 -0
- package/dist/runtime/runtime.js.map +1 -0
- package/dist/runtime/types.d.ts +39 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/{cognee → runtime}/types.js.map +1 -1
- package/dist/text/similarity.d.ts +8 -0
- package/dist/text/similarity.d.ts.map +1 -0
- package/dist/text/similarity.js +161 -0
- package/dist/text/similarity.js.map +1 -0
- package/package.json +6 -2
- package/src/__tests__/brain.test.ts +27 -265
- package/src/__tests__/core-ops.test.ts +190 -0
- package/src/__tests__/curator.test.ts +479 -0
- package/src/__tests__/domain-ops.test.ts +124 -0
- package/src/__tests__/llm-client.test.ts +69 -0
- package/src/__tests__/runtime.test.ts +93 -0
- package/src/brain/brain.ts +19 -342
- package/src/curator/curator.ts +662 -0
- package/src/curator/types.ts +114 -0
- package/src/index.ts +40 -11
- package/src/llm/llm-client.ts +316 -0
- package/src/runtime/core-ops.ts +472 -0
- package/src/runtime/domain-ops.ts +144 -0
- package/src/runtime/runtime.ts +71 -0
- package/src/runtime/types.ts +37 -0
- package/src/text/similarity.ts +168 -0
- package/dist/cognee/client.d.ts +0 -35
- package/dist/cognee/client.d.ts.map +0 -1
- package/dist/cognee/client.js +0 -291
- package/dist/cognee/client.js.map +0 -1
- package/dist/cognee/types.d.ts +0 -46
- package/dist/cognee/types.d.ts.map +0 -1
- package/dist/cognee/types.js +0 -3
- package/src/__tests__/cognee-client.test.ts +0 -524
- package/src/cognee/client.ts +0 -352
- package/src/cognee/types.ts +0 -62
package/src/cognee/client.ts
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CogneeConfig,
|
|
3
|
-
CogneeSearchResult,
|
|
4
|
-
CogneeSearchType,
|
|
5
|
-
CogneeStatus,
|
|
6
|
-
CogneeAddResult,
|
|
7
|
-
CogneeCognifyResult,
|
|
8
|
-
} from './types.js';
|
|
9
|
-
import type { IntelligenceEntry } from '../intelligence/types.js';
|
|
10
|
-
|
|
11
|
-
// ─── Defaults ──────────────────────────────────────────────────────
|
|
12
|
-
// Aligned with Salvador MCP's battle-tested Cognee integration.
|
|
13
|
-
|
|
14
|
-
const DEFAULT_SERVICE_EMAIL = 'soleri-agent@cognee.dev';
|
|
15
|
-
const DEFAULT_SERVICE_PASSWORD = 'soleri-cognee-local';
|
|
16
|
-
|
|
17
|
-
/** Only allow default service credentials for local endpoints. */
|
|
18
|
-
function isLocalUrl(url: string): boolean {
|
|
19
|
-
try {
|
|
20
|
-
const { hostname } = new URL(url);
|
|
21
|
-
return (
|
|
22
|
-
hostname === 'localhost' ||
|
|
23
|
-
hostname === '127.0.0.1' ||
|
|
24
|
-
hostname === '::1' ||
|
|
25
|
-
hostname === '0.0.0.0'
|
|
26
|
-
);
|
|
27
|
-
} catch {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const DEFAULT_CONFIG: CogneeConfig = {
|
|
33
|
-
baseUrl: 'http://localhost:8000',
|
|
34
|
-
dataset: 'vault',
|
|
35
|
-
timeoutMs: 30_000,
|
|
36
|
-
searchTimeoutMs: 120_000, // Ollama cold start can take 90s
|
|
37
|
-
healthTimeoutMs: 5_000,
|
|
38
|
-
healthCacheTtlMs: 60_000,
|
|
39
|
-
cognifyDebounceMs: 30_000,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// ─── CogneeClient ──────────────────────────────────────────────────
|
|
43
|
-
|
|
44
|
-
export class CogneeClient {
|
|
45
|
-
private config: CogneeConfig;
|
|
46
|
-
private healthCache: { status: CogneeStatus; cachedAt: number } | null = null;
|
|
47
|
-
private accessToken: string | null = null;
|
|
48
|
-
private cognifyTimers: Map<string, ReturnType<typeof setTimeout>> = new Map();
|
|
49
|
-
private pendingDatasets: Set<string> = new Set();
|
|
50
|
-
|
|
51
|
-
constructor(config?: Partial<CogneeConfig>) {
|
|
52
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
53
|
-
// Strip trailing slash
|
|
54
|
-
this.config.baseUrl = this.config.baseUrl.replace(/\/+$/, '');
|
|
55
|
-
// Pre-set token if provided
|
|
56
|
-
if (this.config.apiToken) {
|
|
57
|
-
this.accessToken = this.config.apiToken;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// ─── Health ────────────────────────────────────────────────────
|
|
62
|
-
|
|
63
|
-
get isAvailable(): boolean {
|
|
64
|
-
if (!this.healthCache) return false;
|
|
65
|
-
const age = Date.now() - this.healthCache.cachedAt;
|
|
66
|
-
if (age > this.config.healthCacheTtlMs) return false;
|
|
67
|
-
return this.healthCache.status.available;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async healthCheck(): Promise<CogneeStatus> {
|
|
71
|
-
const start = Date.now();
|
|
72
|
-
try {
|
|
73
|
-
// Cognee health endpoint is GET / (returns {"message":"Hello, World, I am alive!"})
|
|
74
|
-
const res = await globalThis.fetch(`${this.config.baseUrl}/`, {
|
|
75
|
-
signal: AbortSignal.timeout(this.config.healthTimeoutMs),
|
|
76
|
-
});
|
|
77
|
-
const latencyMs = Date.now() - start;
|
|
78
|
-
if (res.ok) {
|
|
79
|
-
const status: CogneeStatus = { available: true, url: this.config.baseUrl, latencyMs };
|
|
80
|
-
this.healthCache = { status, cachedAt: Date.now() };
|
|
81
|
-
return status;
|
|
82
|
-
}
|
|
83
|
-
const status: CogneeStatus = {
|
|
84
|
-
available: false,
|
|
85
|
-
url: this.config.baseUrl,
|
|
86
|
-
latencyMs,
|
|
87
|
-
error: `HTTP ${res.status}`,
|
|
88
|
-
};
|
|
89
|
-
this.healthCache = { status, cachedAt: Date.now() };
|
|
90
|
-
return status;
|
|
91
|
-
} catch (err) {
|
|
92
|
-
const latencyMs = Date.now() - start;
|
|
93
|
-
const status: CogneeStatus = {
|
|
94
|
-
available: false,
|
|
95
|
-
url: this.config.baseUrl,
|
|
96
|
-
latencyMs,
|
|
97
|
-
error: err instanceof Error ? err.message : String(err),
|
|
98
|
-
};
|
|
99
|
-
this.healthCache = { status, cachedAt: Date.now() };
|
|
100
|
-
return status;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// ─── Ingest ────────────────────────────────────────────────────
|
|
105
|
-
|
|
106
|
-
async addEntries(entries: IntelligenceEntry[]): Promise<CogneeAddResult> {
|
|
107
|
-
if (!this.isAvailable || entries.length === 0) return { added: 0 };
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const token = await this.ensureAuth().catch(() => null);
|
|
111
|
-
|
|
112
|
-
// Cognee /add expects multipart/form-data with files + datasetName
|
|
113
|
-
const formData = new FormData();
|
|
114
|
-
formData.append('datasetName', this.config.dataset);
|
|
115
|
-
|
|
116
|
-
for (const entry of entries) {
|
|
117
|
-
const text = this.serializeEntry(entry);
|
|
118
|
-
const blob = new Blob([text], { type: 'text/plain' });
|
|
119
|
-
formData.append('data', blob, `${entry.id}.txt`);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const headers: Record<string, string> = {};
|
|
123
|
-
if (token) headers.Authorization = `Bearer ${token}`;
|
|
124
|
-
|
|
125
|
-
const res = await globalThis.fetch(`${this.config.baseUrl}/api/v1/add`, {
|
|
126
|
-
method: 'POST',
|
|
127
|
-
headers,
|
|
128
|
-
body: formData,
|
|
129
|
-
signal: AbortSignal.timeout(this.config.timeoutMs),
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
if (!res.ok) return { added: 0 };
|
|
133
|
-
|
|
134
|
-
// Schedule debounced cognify (multiple rapid ingests coalesce)
|
|
135
|
-
this.scheduleCognify(this.config.dataset);
|
|
136
|
-
|
|
137
|
-
return { added: entries.length };
|
|
138
|
-
} catch {
|
|
139
|
-
return { added: 0 };
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
async cognify(dataset?: string): Promise<CogneeCognifyResult> {
|
|
144
|
-
if (!this.isAvailable) return { status: 'unavailable' };
|
|
145
|
-
|
|
146
|
-
try {
|
|
147
|
-
const res = await this.post('/api/v1/cognify', {
|
|
148
|
-
datasets: [dataset ?? this.config.dataset],
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
if (!res.ok) return { status: `error: HTTP ${res.status}` };
|
|
152
|
-
return { status: 'ok' };
|
|
153
|
-
} catch (err) {
|
|
154
|
-
return { status: `error: ${err instanceof Error ? err.message : String(err)}` };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// ─── Cognify debounce ───────────────────────────────────────────
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Schedule a debounced cognify for a dataset.
|
|
162
|
-
* Sliding window: each call resets the timer. When it expires,
|
|
163
|
-
* cognify fires once. Prevents pipeline dedup on rapid ingests.
|
|
164
|
-
*/
|
|
165
|
-
private scheduleCognify(dataset: string): void {
|
|
166
|
-
const existing = this.cognifyTimers.get(dataset);
|
|
167
|
-
if (existing) clearTimeout(existing);
|
|
168
|
-
|
|
169
|
-
this.pendingDatasets.add(dataset);
|
|
170
|
-
|
|
171
|
-
const timer = setTimeout(() => {
|
|
172
|
-
this.cognifyTimers.delete(dataset);
|
|
173
|
-
this.pendingDatasets.delete(dataset);
|
|
174
|
-
this.post('/api/v1/cognify', { datasets: [dataset] }).catch(() => {});
|
|
175
|
-
}, this.config.cognifyDebounceMs);
|
|
176
|
-
|
|
177
|
-
// Unref so the timer doesn't keep the process alive during shutdown
|
|
178
|
-
if (typeof timer === 'object' && 'unref' in timer) (timer as NodeJS.Timeout).unref();
|
|
179
|
-
|
|
180
|
-
this.cognifyTimers.set(dataset, timer);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** Flush all pending debounced cognify calls immediately. */
|
|
184
|
-
async flushPendingCognify(): Promise<void> {
|
|
185
|
-
const datasets = [...this.pendingDatasets];
|
|
186
|
-
for (const timer of this.cognifyTimers.values()) clearTimeout(timer);
|
|
187
|
-
this.cognifyTimers.clear();
|
|
188
|
-
this.pendingDatasets.clear();
|
|
189
|
-
|
|
190
|
-
if (datasets.length === 0) return;
|
|
191
|
-
|
|
192
|
-
await Promise.allSettled(
|
|
193
|
-
datasets.map((ds) => this.post('/api/v1/cognify', { datasets: [ds] }).catch(() => {})),
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/** Cancel all pending cognify calls without firing them. For test teardown. */
|
|
198
|
-
resetPendingCognify(): void {
|
|
199
|
-
for (const timer of this.cognifyTimers.values()) clearTimeout(timer);
|
|
200
|
-
this.cognifyTimers.clear();
|
|
201
|
-
this.pendingDatasets.clear();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// ─── Search ────────────────────────────────────────────────────
|
|
205
|
-
|
|
206
|
-
async search(
|
|
207
|
-
query: string,
|
|
208
|
-
opts?: { searchType?: CogneeSearchType; limit?: number },
|
|
209
|
-
): Promise<CogneeSearchResult[]> {
|
|
210
|
-
if (!this.isAvailable) return [];
|
|
211
|
-
|
|
212
|
-
// Default to CHUNKS (pure vector similarity) — GRAPH_COMPLETION requires
|
|
213
|
-
// the LLM to produce instructor-compatible JSON which small local models
|
|
214
|
-
// (llama3.2) can't do reliably, causing infinite retries and timeouts.
|
|
215
|
-
const searchType = opts?.searchType ?? 'CHUNKS';
|
|
216
|
-
const topK = opts?.limit ?? 10;
|
|
217
|
-
|
|
218
|
-
try {
|
|
219
|
-
const res = await this.post(
|
|
220
|
-
'/api/v1/search',
|
|
221
|
-
{ query, search_type: searchType, datasets: [this.config.dataset], topK },
|
|
222
|
-
this.config.searchTimeoutMs,
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
if (!res.ok) return [];
|
|
226
|
-
|
|
227
|
-
const data = (await res.json()) as Array<{
|
|
228
|
-
id?: string;
|
|
229
|
-
text?: string;
|
|
230
|
-
score?: number;
|
|
231
|
-
payload?: { id?: string };
|
|
232
|
-
}>;
|
|
233
|
-
|
|
234
|
-
// Position-based scoring when Cognee omits scores.
|
|
235
|
-
// Cognee returns results ordered by relevance but may not include numeric scores.
|
|
236
|
-
return data.slice(0, topK).map((item, idx) => ({
|
|
237
|
-
id: item.payload?.id ?? item.id ?? '',
|
|
238
|
-
score: item.score ?? positionScore(idx, data.length),
|
|
239
|
-
text: typeof item.text === 'string' ? item.text : String(item.text ?? ''),
|
|
240
|
-
searchType,
|
|
241
|
-
}));
|
|
242
|
-
} catch {
|
|
243
|
-
return [];
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// ─── Config access ─────────────────────────────────────────────
|
|
248
|
-
|
|
249
|
-
getConfig(): Readonly<CogneeConfig> {
|
|
250
|
-
return { ...this.config };
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
getStatus(): CogneeStatus | null {
|
|
254
|
-
return this.healthCache?.status ?? null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
// ─── Auth ──────────────────────────────────────────────────────
|
|
258
|
-
// Auto-register + login pattern from Salvador MCP.
|
|
259
|
-
// Tries login first (account may already exist), falls back to register.
|
|
260
|
-
|
|
261
|
-
private async ensureAuth(): Promise<string> {
|
|
262
|
-
if (this.accessToken) return this.accessToken;
|
|
263
|
-
|
|
264
|
-
const email = this.config.serviceEmail ?? DEFAULT_SERVICE_EMAIL;
|
|
265
|
-
const password = this.config.servicePassword ?? DEFAULT_SERVICE_PASSWORD;
|
|
266
|
-
|
|
267
|
-
// Refuse default credentials for non-local endpoints
|
|
268
|
-
if (
|
|
269
|
-
!isLocalUrl(this.config.baseUrl) &&
|
|
270
|
-
email === DEFAULT_SERVICE_EMAIL &&
|
|
271
|
-
password === DEFAULT_SERVICE_PASSWORD
|
|
272
|
-
) {
|
|
273
|
-
throw new Error('Explicit Cognee credentials are required for non-local endpoints');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// Try login first
|
|
277
|
-
const loginResp = await globalThis.fetch(`${this.config.baseUrl}/api/v1/auth/login`, {
|
|
278
|
-
method: 'POST',
|
|
279
|
-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
280
|
-
body: `username=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`,
|
|
281
|
-
signal: AbortSignal.timeout(this.config.healthTimeoutMs),
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
if (loginResp.ok) {
|
|
285
|
-
const data = (await loginResp.json()) as { access_token: string };
|
|
286
|
-
this.accessToken = data.access_token;
|
|
287
|
-
return this.accessToken;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Register, then retry login
|
|
291
|
-
await globalThis.fetch(`${this.config.baseUrl}/api/v1/auth/register`, {
|
|
292
|
-
method: 'POST',
|
|
293
|
-
headers: { 'Content-Type': 'application/json' },
|
|
294
|
-
body: JSON.stringify({ email, password }),
|
|
295
|
-
signal: AbortSignal.timeout(this.config.healthTimeoutMs),
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
const retryLogin = await globalThis.fetch(`${this.config.baseUrl}/api/v1/auth/login`, {
|
|
299
|
-
method: 'POST',
|
|
300
|
-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
301
|
-
body: `username=${encodeURIComponent(email)}&password=${encodeURIComponent(password)}`,
|
|
302
|
-
signal: AbortSignal.timeout(this.config.healthTimeoutMs),
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
if (!retryLogin.ok) {
|
|
306
|
-
throw new Error(`Cognee auth failed: HTTP ${retryLogin.status}`);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const retryData = (await retryLogin.json()) as { access_token: string };
|
|
310
|
-
this.accessToken = retryData.access_token;
|
|
311
|
-
return this.accessToken;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
private async authHeaders(): Promise<Record<string, string>> {
|
|
315
|
-
try {
|
|
316
|
-
const token = await this.ensureAuth();
|
|
317
|
-
return { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` };
|
|
318
|
-
} catch {
|
|
319
|
-
// Fall back to no auth (works if AUTH_REQUIRED=false)
|
|
320
|
-
return { 'Content-Type': 'application/json' };
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// ─── Private helpers ───────────────────────────────────────────
|
|
325
|
-
|
|
326
|
-
private serializeEntry(entry: IntelligenceEntry): string {
|
|
327
|
-
// Prefix with vault ID so we can cross-reference search results back to vault entries.
|
|
328
|
-
// Cognee assigns its own UUIDs to chunks — the vault ID would otherwise be lost.
|
|
329
|
-
const parts = [`[vault-id:${entry.id}]`, entry.title, entry.description];
|
|
330
|
-
if (entry.context) parts.push(entry.context);
|
|
331
|
-
if (entry.tags.length > 0) parts.push(`Tags: ${entry.tags.join(', ')}`);
|
|
332
|
-
return parts.join('\n');
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
private async post(path: string, body: unknown, timeoutMs?: number): Promise<Response> {
|
|
336
|
-
const headers = await this.authHeaders();
|
|
337
|
-
return globalThis.fetch(`${this.config.baseUrl}${path}`, {
|
|
338
|
-
method: 'POST',
|
|
339
|
-
headers,
|
|
340
|
-
body: JSON.stringify(body),
|
|
341
|
-
signal: AbortSignal.timeout(timeoutMs ?? this.config.timeoutMs),
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// ─── Helpers ──────────────────────────────────────────────────────
|
|
347
|
-
|
|
348
|
-
/** Position-based score: first result gets ~1.0, last gets ~0.05. */
|
|
349
|
-
function positionScore(index: number, total: number): number {
|
|
350
|
-
if (total <= 1) return 1.0;
|
|
351
|
-
return Math.max(0.05, 1.0 - (index / (total - 1)) * 0.95);
|
|
352
|
-
}
|
package/src/cognee/types.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// ─── Cognee Integration Types ──────────────────────────────────────
|
|
2
|
-
|
|
3
|
-
export interface CogneeConfig {
|
|
4
|
-
/** Base URL of the Cognee API (default: http://localhost:8000) */
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
/** Dataset name for this agent's vault entries */
|
|
7
|
-
dataset: string;
|
|
8
|
-
/** Bearer token for Cognee API authentication (auto-acquired if not set) */
|
|
9
|
-
apiToken?: string;
|
|
10
|
-
/** Service account email for auto-login (default: soleri-agent@cognee.dev) */
|
|
11
|
-
serviceEmail?: string;
|
|
12
|
-
/** Service account password for auto-login */
|
|
13
|
-
servicePassword?: string;
|
|
14
|
-
/** Default request timeout in milliseconds (default: 30000) */
|
|
15
|
-
timeoutMs: number;
|
|
16
|
-
/** Search timeout in milliseconds — Ollama cold start can take 90s (default: 120000) */
|
|
17
|
-
searchTimeoutMs: number;
|
|
18
|
-
/** Health check timeout in milliseconds (default: 5000) */
|
|
19
|
-
healthTimeoutMs: number;
|
|
20
|
-
/** Health check cache TTL in milliseconds (default: 60000) */
|
|
21
|
-
healthCacheTtlMs: number;
|
|
22
|
-
/** Cognify debounce window in milliseconds (default: 30000) */
|
|
23
|
-
cognifyDebounceMs: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface CogneeSearchResult {
|
|
27
|
-
/** Vault entry ID (cross-reference key) */
|
|
28
|
-
id: string;
|
|
29
|
-
/** Relevance score (0–1). Position-based when Cognee omits scores. */
|
|
30
|
-
score: number;
|
|
31
|
-
/** Text content from Cognee */
|
|
32
|
-
text: string;
|
|
33
|
-
/** Cognee search type that produced this result */
|
|
34
|
-
searchType: CogneeSearchType;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type CogneeSearchType =
|
|
38
|
-
| 'SUMMARIES'
|
|
39
|
-
| 'CHUNKS'
|
|
40
|
-
| 'RAG_COMPLETION'
|
|
41
|
-
| 'TRIPLET_COMPLETION'
|
|
42
|
-
| 'GRAPH_COMPLETION'
|
|
43
|
-
| 'GRAPH_SUMMARY_COMPLETION'
|
|
44
|
-
| 'NATURAL_LANGUAGE'
|
|
45
|
-
| 'GRAPH_COMPLETION_COT'
|
|
46
|
-
| 'FEELING_LUCKY'
|
|
47
|
-
| 'CHUNKS_LEXICAL';
|
|
48
|
-
|
|
49
|
-
export interface CogneeStatus {
|
|
50
|
-
available: boolean;
|
|
51
|
-
url: string;
|
|
52
|
-
latencyMs: number;
|
|
53
|
-
error?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface CogneeAddResult {
|
|
57
|
-
added: number;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface CogneeCognifyResult {
|
|
61
|
-
status: string;
|
|
62
|
-
}
|