@usewhisper/sdk 3.10.0 → 3.10.1
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 +285 -215
- package/adapters/ai-sdk.d.mts +2434 -0
- package/adapters/ai-sdk.d.ts +2434 -0
- package/adapters/ai-sdk.js +3141 -0
- package/adapters/ai-sdk.mjs +3104 -0
- package/adapters/tools.d.mts +2 -0
- package/adapters/tools.d.ts +2 -0
- package/adapters/tools.js +7097 -0
- package/adapters/tools.mjs +7066 -0
- package/index.d.mts +2 -2265
- package/index.d.ts +2 -2265
- package/index.js +4995 -123
- package/index.mjs +4996 -122
- package/package.json +30 -3
- package/router/memory-router.d.mts +2 -0
- package/router/memory-router.d.ts +2 -0
- package/router/memory-router.js +3118 -0
- package/router/memory-router.mjs +3080 -0
package/index.d.ts
CHANGED
|
@@ -1,2265 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
cache_ms: number;
|
|
4
|
-
embed_ms: number;
|
|
5
|
-
vector_ms: number;
|
|
6
|
-
lexical_ms: number;
|
|
7
|
-
merge_ms: number;
|
|
8
|
-
total_ms: number;
|
|
9
|
-
}
|
|
10
|
-
interface MemorySearchResult {
|
|
11
|
-
memory: {
|
|
12
|
-
id: string;
|
|
13
|
-
content: string;
|
|
14
|
-
type: string;
|
|
15
|
-
entities?: string[];
|
|
16
|
-
confidence?: number;
|
|
17
|
-
version?: number;
|
|
18
|
-
temporal?: {
|
|
19
|
-
document_date?: string | null;
|
|
20
|
-
event_date?: string | null;
|
|
21
|
-
valid_from?: string | null;
|
|
22
|
-
valid_until?: string | null;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
similarity: number;
|
|
26
|
-
relations?: Array<Record<string, unknown>>;
|
|
27
|
-
chunk?: {
|
|
28
|
-
id: string;
|
|
29
|
-
content: string;
|
|
30
|
-
metadata?: Record<string, unknown>;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
interface MemorySearchResponse$1 {
|
|
34
|
-
results: MemorySearchResult[];
|
|
35
|
-
count: number;
|
|
36
|
-
query: string;
|
|
37
|
-
trace_id?: string;
|
|
38
|
-
latency_ms?: number;
|
|
39
|
-
latency_breakdown?: MemoryLatencyBreakdown$1;
|
|
40
|
-
fallback?: "vector" | "lexical";
|
|
41
|
-
mode?: "fast" | "balanced" | "quality";
|
|
42
|
-
profile?: "fast" | "balanced" | "quality";
|
|
43
|
-
include_pending?: boolean;
|
|
44
|
-
pending_overlay_count?: number;
|
|
45
|
-
cache_hit?: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface MemoryWriteAck$1 {
|
|
48
|
-
success: boolean;
|
|
49
|
-
mode?: "async" | "sync";
|
|
50
|
-
trace_id?: string;
|
|
51
|
-
memory_id?: string;
|
|
52
|
-
job_id?: string;
|
|
53
|
-
status_url?: string;
|
|
54
|
-
accepted_at?: string;
|
|
55
|
-
visibility_sla_ms?: number;
|
|
56
|
-
pending_visibility?: boolean;
|
|
57
|
-
semantic_status?: "pending" | "ready";
|
|
58
|
-
queued?: boolean;
|
|
59
|
-
event_id?: string;
|
|
60
|
-
created?: number;
|
|
61
|
-
errors?: string[];
|
|
62
|
-
}
|
|
63
|
-
type LearnIngestionProfile = "auto" | "repo" | "web_docs" | "pdf_layout" | "video_transcript" | "plain_text";
|
|
64
|
-
type LearnStrategyOverride = "fixed" | "recursive" | "semantic" | "hierarchical" | "adaptive";
|
|
65
|
-
type LearnSourceType = "github" | "web" | "playwright" | "pdf" | "local" | "slack" | "video";
|
|
66
|
-
interface LearnConversationInput {
|
|
67
|
-
mode: "conversation";
|
|
68
|
-
project?: string;
|
|
69
|
-
user_id?: string;
|
|
70
|
-
session_id: string;
|
|
71
|
-
messages: Array<{
|
|
72
|
-
role: string;
|
|
73
|
-
content: string;
|
|
74
|
-
timestamp?: string;
|
|
75
|
-
}>;
|
|
76
|
-
}
|
|
77
|
-
interface LearnTextInput {
|
|
78
|
-
mode: "text";
|
|
79
|
-
project?: string;
|
|
80
|
-
title: string;
|
|
81
|
-
content: string;
|
|
82
|
-
metadata?: Record<string, unknown>;
|
|
83
|
-
tags?: string[];
|
|
84
|
-
namespace?: string;
|
|
85
|
-
options?: {
|
|
86
|
-
async?: boolean;
|
|
87
|
-
ingestion_profile?: LearnIngestionProfile;
|
|
88
|
-
strategy_override?: LearnStrategyOverride;
|
|
89
|
-
profile_config?: Record<string, unknown>;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
interface LearnSourceInput {
|
|
93
|
-
mode: "source";
|
|
94
|
-
project?: string;
|
|
95
|
-
type: LearnSourceType;
|
|
96
|
-
name?: string;
|
|
97
|
-
metadata?: Record<string, string>;
|
|
98
|
-
owner?: string;
|
|
99
|
-
repo?: string;
|
|
100
|
-
branch?: string;
|
|
101
|
-
paths?: string[];
|
|
102
|
-
url?: string;
|
|
103
|
-
file_path?: string;
|
|
104
|
-
path?: string;
|
|
105
|
-
channel_ids?: string[];
|
|
106
|
-
since?: string;
|
|
107
|
-
token?: string;
|
|
108
|
-
auth_ref?: string;
|
|
109
|
-
platform?: "youtube" | "loom" | "generic";
|
|
110
|
-
language?: string;
|
|
111
|
-
options?: {
|
|
112
|
-
async?: boolean;
|
|
113
|
-
auto_index?: boolean;
|
|
114
|
-
ingestion_profile?: LearnIngestionProfile;
|
|
115
|
-
strategy_override?: LearnStrategyOverride;
|
|
116
|
-
profile_config?: Record<string, unknown>;
|
|
117
|
-
crawl_depth?: number;
|
|
118
|
-
include_paths?: string[];
|
|
119
|
-
exclude_paths?: string[];
|
|
120
|
-
glob?: string;
|
|
121
|
-
max_files?: number;
|
|
122
|
-
max_pages?: number;
|
|
123
|
-
extract_mode?: "text" | "structured" | "markdown";
|
|
124
|
-
workspace_id?: string;
|
|
125
|
-
allow_stt_fallback?: boolean;
|
|
126
|
-
max_duration_minutes?: number;
|
|
127
|
-
max_chunks?: number;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
type LearnInput = LearnConversationInput | LearnTextInput | LearnSourceInput;
|
|
131
|
-
interface LearnConversationResult {
|
|
132
|
-
success: true;
|
|
133
|
-
mode: "conversation";
|
|
134
|
-
project: string;
|
|
135
|
-
scope_mode: "user_session" | "session_only";
|
|
136
|
-
memories_created: number;
|
|
137
|
-
relations_created: number;
|
|
138
|
-
memories_invalidated: number;
|
|
139
|
-
errors?: string[];
|
|
140
|
-
}
|
|
141
|
-
interface LearnTextResult {
|
|
142
|
-
success: true;
|
|
143
|
-
mode: "text";
|
|
144
|
-
project: string;
|
|
145
|
-
status: "processing" | "completed";
|
|
146
|
-
job_id?: string | null;
|
|
147
|
-
chunks_indexed?: number;
|
|
148
|
-
source_id?: string | null;
|
|
149
|
-
}
|
|
150
|
-
interface LearnSourceResult {
|
|
151
|
-
success: true;
|
|
152
|
-
mode: "source";
|
|
153
|
-
project: string;
|
|
154
|
-
source_id: string;
|
|
155
|
-
status: string;
|
|
156
|
-
job_id?: string | null;
|
|
157
|
-
index_started: boolean;
|
|
158
|
-
}
|
|
159
|
-
type LearnResult = LearnConversationResult | LearnTextResult | LearnSourceResult;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Whisper - Simple Memory Layer for AI Agents
|
|
163
|
-
*
|
|
164
|
-
* Two methods:
|
|
165
|
-
* - getContext(): Retrieve relevant context before LLM call
|
|
166
|
-
* - capture(): Extract and store memories after LLM response
|
|
167
|
-
*
|
|
168
|
-
* Zero magic - you control when to get context and when to capture
|
|
169
|
-
*/
|
|
170
|
-
|
|
171
|
-
interface WhisperOptions extends WhisperConfig {
|
|
172
|
-
/**
|
|
173
|
-
* Maximum context results to retrieve.
|
|
174
|
-
* Default: 10
|
|
175
|
-
*/
|
|
176
|
-
contextLimit?: number;
|
|
177
|
-
/**
|
|
178
|
-
* Which memory types to use.
|
|
179
|
-
* Default: all 7 types
|
|
180
|
-
*/
|
|
181
|
-
memoryTypes?: Array<"factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction">;
|
|
182
|
-
/**
|
|
183
|
-
* Prefix for context injection.
|
|
184
|
-
* Default: "Relevant context:"
|
|
185
|
-
*/
|
|
186
|
-
contextPrefix?: string;
|
|
187
|
-
/**
|
|
188
|
-
* Extract structured memories before writing.
|
|
189
|
-
* Default: true
|
|
190
|
-
*/
|
|
191
|
-
autoExtract?: boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Minimum extraction confidence for auto-write.
|
|
194
|
-
* Default: 0.65
|
|
195
|
-
*/
|
|
196
|
-
autoExtractMinConfidence?: number;
|
|
197
|
-
/**
|
|
198
|
-
* Maximum extracted memories to write per remember/capture call.
|
|
199
|
-
* Default: 5
|
|
200
|
-
*/
|
|
201
|
-
maxMemoriesPerCapture?: number;
|
|
202
|
-
}
|
|
203
|
-
interface ContextResult {
|
|
204
|
-
context: string;
|
|
205
|
-
results: QueryResult["results"];
|
|
206
|
-
count: number;
|
|
207
|
-
}
|
|
208
|
-
interface RememberResult {
|
|
209
|
-
success: boolean;
|
|
210
|
-
memoryId?: string;
|
|
211
|
-
memoryIds?: string[];
|
|
212
|
-
extracted?: number;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Simple, transparent memory layer
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```typescript
|
|
219
|
-
* import { Whisper } from '@usewhisper/sdk';
|
|
220
|
-
*
|
|
221
|
-
* const whisper = new Whisper({
|
|
222
|
-
* apiKey: process.env.WHISPER_KEY,
|
|
223
|
-
* project: 'my-app'
|
|
224
|
-
* });
|
|
225
|
-
*
|
|
226
|
-
* // BEFORE: Get relevant context
|
|
227
|
-
* const { context, results } = await whisper.getContext("What does user prefer?");
|
|
228
|
-
*
|
|
229
|
-
* // Inject context into your LLM prompt
|
|
230
|
-
* const prompt = `${context}\n\nUser: What does user prefer?`;
|
|
231
|
-
* const response = await llm.complete(prompt);
|
|
232
|
-
*
|
|
233
|
-
* // AFTER: Capture what happened
|
|
234
|
-
* await whisper.capture(response);
|
|
235
|
-
* // → Memories extracted & stored (async)
|
|
236
|
-
* ```
|
|
237
|
-
*/
|
|
238
|
-
declare class Whisper {
|
|
239
|
-
private client;
|
|
240
|
-
private runtimeClient;
|
|
241
|
-
private options;
|
|
242
|
-
private sessionId?;
|
|
243
|
-
private userId?;
|
|
244
|
-
constructor(options: WhisperOptions);
|
|
245
|
-
/**
|
|
246
|
-
* Set session ID for conversation tracking
|
|
247
|
-
*/
|
|
248
|
-
session(sessionId: string): this;
|
|
249
|
-
/**
|
|
250
|
-
* Set user ID for user-specific memories
|
|
251
|
-
*/
|
|
252
|
-
user(userId: string): this;
|
|
253
|
-
/**
|
|
254
|
-
* Get relevant context BEFORE your LLM call
|
|
255
|
-
*
|
|
256
|
-
* @param query - What you want to know / user question
|
|
257
|
-
* @returns Context string and raw results
|
|
258
|
-
*
|
|
259
|
-
* @example
|
|
260
|
-
* ```typescript
|
|
261
|
-
* const { context, results, count } = await whisper.getContext(
|
|
262
|
-
* "What are user's preferences?",
|
|
263
|
-
* { userId: "user-123" }
|
|
264
|
-
* );
|
|
265
|
-
*
|
|
266
|
-
* // Results: [
|
|
267
|
-
* // { content: "User prefers dark mode", type: "preference", score: 0.95 },
|
|
268
|
-
* // { content: "Allergic to nuts", type: "factual", score: 0.89 }
|
|
269
|
-
* // ]
|
|
270
|
-
* ```
|
|
271
|
-
*/
|
|
272
|
-
getContext(query: string, options?: {
|
|
273
|
-
userId?: string;
|
|
274
|
-
sessionId?: string;
|
|
275
|
-
project?: string;
|
|
276
|
-
limit?: number;
|
|
277
|
-
}): Promise<ContextResult>;
|
|
278
|
-
/**
|
|
279
|
-
* Remember what happened AFTER your LLM response
|
|
280
|
-
*
|
|
281
|
-
* Fire-and-forget - doesn't block your response
|
|
282
|
-
*
|
|
283
|
-
* @param content - What your LLM responded with
|
|
284
|
-
* @returns Promise that resolves when stored (or fails silently)
|
|
285
|
-
*
|
|
286
|
-
* @example
|
|
287
|
-
* ```typescript
|
|
288
|
-
* const llmResponse = "I've set your theme to dark mode and removed nuts from recommendations.";
|
|
289
|
-
*
|
|
290
|
-
* await whisper.remember(llmResponse, { userId: "user-123" });
|
|
291
|
-
* // → Auto-extracts: "theme set to dark mode", "nut allergy"
|
|
292
|
-
* // → Stored as preferences
|
|
293
|
-
* ```
|
|
294
|
-
*/
|
|
295
|
-
remember(content: string, options?: {
|
|
296
|
-
userId?: string;
|
|
297
|
-
sessionId?: string;
|
|
298
|
-
project?: string;
|
|
299
|
-
}): Promise<RememberResult>;
|
|
300
|
-
/**
|
|
301
|
-
* Alias for remember() - same thing
|
|
302
|
-
*/
|
|
303
|
-
capture(content: string, options?: {
|
|
304
|
-
userId?: string;
|
|
305
|
-
sessionId?: string;
|
|
306
|
-
project?: string;
|
|
307
|
-
}): Promise<RememberResult>;
|
|
308
|
-
/**
|
|
309
|
-
* Capture from multiple messages (e.g., full conversation)
|
|
310
|
-
*/
|
|
311
|
-
captureSession(messages: Array<{
|
|
312
|
-
role: string;
|
|
313
|
-
content: string;
|
|
314
|
-
}>, options?: {
|
|
315
|
-
userId?: string;
|
|
316
|
-
sessionId?: string;
|
|
317
|
-
project?: string;
|
|
318
|
-
auto_learn?: boolean;
|
|
319
|
-
}): Promise<{
|
|
320
|
-
success: boolean;
|
|
321
|
-
extracted: number;
|
|
322
|
-
}>;
|
|
323
|
-
/**
|
|
324
|
-
* Run a full agent turn with automatic memory read (before) + write (after).
|
|
325
|
-
*/
|
|
326
|
-
runTurn(params: {
|
|
327
|
-
userMessage: string;
|
|
328
|
-
generate: (prompt: string) => Promise<string>;
|
|
329
|
-
userId?: string;
|
|
330
|
-
sessionId?: string;
|
|
331
|
-
project?: string;
|
|
332
|
-
limit?: number;
|
|
333
|
-
auto_learn?: boolean;
|
|
334
|
-
}): Promise<{
|
|
335
|
-
response: string;
|
|
336
|
-
context: string;
|
|
337
|
-
count: number;
|
|
338
|
-
extracted: number;
|
|
339
|
-
}>;
|
|
340
|
-
learn(input: LearnInput): Promise<LearnResult>;
|
|
341
|
-
/**
|
|
342
|
-
* Direct access to WhisperContext for advanced usage
|
|
343
|
-
*/
|
|
344
|
-
raw(): WhisperContext;
|
|
345
|
-
private extractMemoryIdsFromBulkResponse;
|
|
346
|
-
private fallbackCaptureViaAddMemory;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
type CompatMode = "fallback" | "strict";
|
|
350
|
-
type OperationType = "search" | "writeAck" | "bulk" | "profile" | "session" | "query" | "get";
|
|
351
|
-
interface TimeoutBudgets {
|
|
352
|
-
searchMs: number;
|
|
353
|
-
writeAckMs: number;
|
|
354
|
-
bulkMs: number;
|
|
355
|
-
profileMs: number;
|
|
356
|
-
sessionMs: number;
|
|
357
|
-
}
|
|
358
|
-
interface RetryPolicy {
|
|
359
|
-
maxAttemptsByOperation?: Partial<Record<OperationType, number>>;
|
|
360
|
-
retryableStatusCodes?: number[];
|
|
361
|
-
retryOnNetworkError?: boolean;
|
|
362
|
-
maxBackoffMs?: number;
|
|
363
|
-
baseBackoffMs?: number;
|
|
364
|
-
}
|
|
365
|
-
interface RuntimeRequestOptions {
|
|
366
|
-
endpoint: string;
|
|
367
|
-
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
368
|
-
body?: Record<string, unknown> | undefined;
|
|
369
|
-
headers?: Record<string, string> | undefined;
|
|
370
|
-
operation: OperationType;
|
|
371
|
-
idempotent?: boolean;
|
|
372
|
-
traceId?: string;
|
|
373
|
-
dedupeKeyExtra?: string;
|
|
374
|
-
}
|
|
375
|
-
interface RuntimeClientOptions {
|
|
376
|
-
apiKey: string;
|
|
377
|
-
baseUrl?: string;
|
|
378
|
-
sdkVersion?: string;
|
|
379
|
-
compatMode?: CompatMode;
|
|
380
|
-
timeouts?: Partial<TimeoutBudgets>;
|
|
381
|
-
retryPolicy?: RetryPolicy;
|
|
382
|
-
fetchImpl?: typeof fetch;
|
|
383
|
-
}
|
|
384
|
-
interface RuntimeResponse<T> {
|
|
385
|
-
data: T;
|
|
386
|
-
status: number;
|
|
387
|
-
traceId: string;
|
|
388
|
-
}
|
|
389
|
-
interface DiagnosticsRecord {
|
|
390
|
-
id: string;
|
|
391
|
-
startedAt: string;
|
|
392
|
-
endedAt: string;
|
|
393
|
-
traceId: string;
|
|
394
|
-
spanId: string;
|
|
395
|
-
operation: OperationType;
|
|
396
|
-
method: string;
|
|
397
|
-
endpoint: string;
|
|
398
|
-
status?: number;
|
|
399
|
-
durationMs: number;
|
|
400
|
-
success: boolean;
|
|
401
|
-
deduped?: boolean;
|
|
402
|
-
errorCode?: string;
|
|
403
|
-
errorMessage?: string;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
type DiagnosticsSubscriber = (record: DiagnosticsRecord) => void;
|
|
407
|
-
declare class DiagnosticsStore {
|
|
408
|
-
private readonly maxEntries;
|
|
409
|
-
private readonly records;
|
|
410
|
-
private readonly subscribers;
|
|
411
|
-
constructor(maxEntries?: number);
|
|
412
|
-
add(record: DiagnosticsRecord): void;
|
|
413
|
-
getLast(limit?: number): DiagnosticsRecord[];
|
|
414
|
-
snapshot(): {
|
|
415
|
-
total: number;
|
|
416
|
-
success: number;
|
|
417
|
-
failure: number;
|
|
418
|
-
avgDurationMs: number;
|
|
419
|
-
lastTraceId?: string;
|
|
420
|
-
};
|
|
421
|
-
subscribe(fn: DiagnosticsSubscriber): () => void;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
interface QueuedWrite {
|
|
425
|
-
eventId: string;
|
|
426
|
-
project: string;
|
|
427
|
-
userId?: string;
|
|
428
|
-
sessionId?: string;
|
|
429
|
-
payload: {
|
|
430
|
-
content: string;
|
|
431
|
-
memory_type?: string;
|
|
432
|
-
user_id?: string;
|
|
433
|
-
session_id?: string;
|
|
434
|
-
agent_id?: string;
|
|
435
|
-
importance?: number;
|
|
436
|
-
confidence?: number;
|
|
437
|
-
metadata?: Record<string, unknown>;
|
|
438
|
-
document_date?: string;
|
|
439
|
-
event_date?: string;
|
|
440
|
-
};
|
|
441
|
-
createdAt: string;
|
|
442
|
-
}
|
|
443
|
-
interface QueueStore {
|
|
444
|
-
load(): Promise<QueuedWrite[]>;
|
|
445
|
-
save(items: QueuedWrite[]): Promise<void>;
|
|
446
|
-
}
|
|
447
|
-
interface WriteQueueStatus {
|
|
448
|
-
queued: number;
|
|
449
|
-
flushing: boolean;
|
|
450
|
-
lastFlushAt?: string;
|
|
451
|
-
lastFlushCount: number;
|
|
452
|
-
}
|
|
453
|
-
type FlushHandler = (items: QueuedWrite[]) => Promise<void>;
|
|
454
|
-
declare class WriteQueue {
|
|
455
|
-
private readonly flushHandler;
|
|
456
|
-
private readonly store;
|
|
457
|
-
private readonly maxBatchSize;
|
|
458
|
-
private readonly flushIntervalMs;
|
|
459
|
-
private readonly maxAttempts;
|
|
460
|
-
private readonly queue;
|
|
461
|
-
private flushTimer;
|
|
462
|
-
private flushing;
|
|
463
|
-
private lastFlushAt?;
|
|
464
|
-
private lastFlushCount;
|
|
465
|
-
constructor(args: {
|
|
466
|
-
flushHandler: FlushHandler;
|
|
467
|
-
store?: QueueStore;
|
|
468
|
-
maxBatchSize?: number;
|
|
469
|
-
flushIntervalMs?: number;
|
|
470
|
-
maxAttempts?: number;
|
|
471
|
-
});
|
|
472
|
-
start(): Promise<void>;
|
|
473
|
-
stop(): Promise<void>;
|
|
474
|
-
status(): WriteQueueStatus;
|
|
475
|
-
enqueue(input: Omit<QueuedWrite, "eventId" | "createdAt"> & {
|
|
476
|
-
eventId?: string;
|
|
477
|
-
}): Promise<QueuedWrite>;
|
|
478
|
-
flush(): Promise<void>;
|
|
479
|
-
private makeEventId;
|
|
480
|
-
private bindProcessHooks;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
declare class RuntimeClient {
|
|
484
|
-
private readonly apiKey;
|
|
485
|
-
private readonly baseUrl;
|
|
486
|
-
private readonly sdkVersion;
|
|
487
|
-
private readonly compatMode;
|
|
488
|
-
private readonly retryPolicy;
|
|
489
|
-
private readonly timeouts;
|
|
490
|
-
private readonly diagnostics;
|
|
491
|
-
private readonly inFlight;
|
|
492
|
-
private readonly sendApiKeyHeader;
|
|
493
|
-
private readonly fetchImpl;
|
|
494
|
-
constructor(options: RuntimeClientOptions, diagnostics?: DiagnosticsStore);
|
|
495
|
-
getDiagnosticsStore(): DiagnosticsStore;
|
|
496
|
-
getCompatMode(): CompatMode;
|
|
497
|
-
private timeoutFor;
|
|
498
|
-
private maxAttemptsFor;
|
|
499
|
-
private shouldRetryStatus;
|
|
500
|
-
private backoff;
|
|
501
|
-
private runtimeName;
|
|
502
|
-
private apiKeyOnlyPrefixes;
|
|
503
|
-
private shouldAttachApiKeyHeader;
|
|
504
|
-
private createRequestFingerprint;
|
|
505
|
-
request<T>(options: RuntimeRequestOptions): Promise<RuntimeResponse<T>>;
|
|
506
|
-
private performRequest;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
interface SearchCacheKeyInput {
|
|
510
|
-
project: string;
|
|
511
|
-
userId?: string;
|
|
512
|
-
sessionId?: string;
|
|
513
|
-
query: string;
|
|
514
|
-
topK: number;
|
|
515
|
-
profile: string;
|
|
516
|
-
includePending: boolean;
|
|
517
|
-
}
|
|
518
|
-
declare class SearchResponseCache<T = unknown> {
|
|
519
|
-
private readonly ttlMs;
|
|
520
|
-
private readonly capacity;
|
|
521
|
-
private readonly byKey;
|
|
522
|
-
private readonly scopeIndex;
|
|
523
|
-
constructor(ttlMs?: number, capacity?: number);
|
|
524
|
-
makeScopeKey(project: string, userId?: string, sessionId?: string): string;
|
|
525
|
-
makeKey(input: SearchCacheKeyInput): string;
|
|
526
|
-
get(key: string): T | null;
|
|
527
|
-
set(key: string, scopeKey: string, value: T): void;
|
|
528
|
-
invalidateScope(scopeKey: string): number;
|
|
529
|
-
private evictIfNeeded;
|
|
530
|
-
private deleteByKey;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
interface MemoryModuleOptions {
|
|
534
|
-
defaultProject?: string;
|
|
535
|
-
cacheEnabled?: boolean;
|
|
536
|
-
queueEnabled?: boolean;
|
|
537
|
-
}
|
|
538
|
-
declare class MemoryModule {
|
|
539
|
-
private readonly client;
|
|
540
|
-
private readonly cache;
|
|
541
|
-
private readonly queue;
|
|
542
|
-
private readonly options;
|
|
543
|
-
constructor(client: RuntimeClient, cache: SearchResponseCache<MemorySearchResponse$1>, queue: WriteQueue, options?: MemoryModuleOptions);
|
|
544
|
-
private resolveProject;
|
|
545
|
-
private invalidate;
|
|
546
|
-
add(params: {
|
|
547
|
-
project?: string;
|
|
548
|
-
content: string;
|
|
549
|
-
memory_type?: MemoryKind$1;
|
|
550
|
-
user_id?: string;
|
|
551
|
-
session_id?: string;
|
|
552
|
-
agent_id?: string;
|
|
553
|
-
importance?: number;
|
|
554
|
-
confidence?: number;
|
|
555
|
-
metadata?: Record<string, unknown>;
|
|
556
|
-
document_date?: string;
|
|
557
|
-
event_date?: string;
|
|
558
|
-
write_mode?: "async" | "sync";
|
|
559
|
-
async?: boolean;
|
|
560
|
-
}): Promise<MemoryWriteAck$1>;
|
|
561
|
-
addBulk(params: {
|
|
562
|
-
project?: string;
|
|
563
|
-
memories: Array<{
|
|
564
|
-
content: string;
|
|
565
|
-
memory_type?: MemoryKind$1;
|
|
566
|
-
user_id?: string;
|
|
567
|
-
session_id?: string;
|
|
568
|
-
agent_id?: string;
|
|
569
|
-
importance?: number;
|
|
570
|
-
confidence?: number;
|
|
571
|
-
metadata?: Record<string, unknown>;
|
|
572
|
-
document_date?: string;
|
|
573
|
-
event_date?: string;
|
|
574
|
-
}>;
|
|
575
|
-
write_mode?: "async" | "sync";
|
|
576
|
-
async?: boolean;
|
|
577
|
-
}): Promise<MemoryWriteAck$1>;
|
|
578
|
-
search(params: {
|
|
579
|
-
project?: string;
|
|
580
|
-
query: string;
|
|
581
|
-
user_id?: string;
|
|
582
|
-
session_id?: string;
|
|
583
|
-
top_k?: number;
|
|
584
|
-
memory_type?: MemoryKind$1;
|
|
585
|
-
profile?: "fast" | "balanced" | "quality";
|
|
586
|
-
include_pending?: boolean;
|
|
587
|
-
}): Promise<MemorySearchResponse$1>;
|
|
588
|
-
getUserProfile(params: {
|
|
589
|
-
project?: string;
|
|
590
|
-
user_id: string;
|
|
591
|
-
include_pending?: boolean;
|
|
592
|
-
memory_types?: string;
|
|
593
|
-
}): Promise<{
|
|
594
|
-
user_id: string;
|
|
595
|
-
memories: Array<Record<string, unknown>>;
|
|
596
|
-
count: number;
|
|
597
|
-
}>;
|
|
598
|
-
getSessionMemories(params: {
|
|
599
|
-
project?: string;
|
|
600
|
-
session_id: string;
|
|
601
|
-
include_pending?: boolean;
|
|
602
|
-
limit?: number;
|
|
603
|
-
}): Promise<{
|
|
604
|
-
memories: Array<Record<string, unknown>>;
|
|
605
|
-
count: number;
|
|
606
|
-
}>;
|
|
607
|
-
get(memoryId: string): Promise<{
|
|
608
|
-
memory: Record<string, unknown>;
|
|
609
|
-
}>;
|
|
610
|
-
update(memoryId: string, params: {
|
|
611
|
-
content: string;
|
|
612
|
-
reasoning?: string;
|
|
613
|
-
}): Promise<{
|
|
614
|
-
success: boolean;
|
|
615
|
-
}>;
|
|
616
|
-
delete(memoryId: string): Promise<{
|
|
617
|
-
success: boolean;
|
|
618
|
-
deleted: string;
|
|
619
|
-
}>;
|
|
620
|
-
flag(params: {
|
|
621
|
-
memoryId: string;
|
|
622
|
-
reason: string;
|
|
623
|
-
severity?: "low" | "medium" | "high";
|
|
624
|
-
}): Promise<{
|
|
625
|
-
success: boolean;
|
|
626
|
-
}>;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
type SessionState = "created" | "active" | "suspended" | "resumed" | "ended" | "archived";
|
|
630
|
-
declare class SessionModule {
|
|
631
|
-
private readonly memory;
|
|
632
|
-
private readonly defaultProject?;
|
|
633
|
-
private readonly sessions;
|
|
634
|
-
constructor(memory: MemoryModule, defaultProject?: string | undefined);
|
|
635
|
-
private resolveProject;
|
|
636
|
-
private ensure;
|
|
637
|
-
start(params: {
|
|
638
|
-
userId: string;
|
|
639
|
-
project?: string;
|
|
640
|
-
sessionId?: string;
|
|
641
|
-
metadata?: Record<string, unknown>;
|
|
642
|
-
}): Promise<{
|
|
643
|
-
sessionId: string;
|
|
644
|
-
state: SessionState;
|
|
645
|
-
createdAt: string;
|
|
646
|
-
}>;
|
|
647
|
-
event(params: {
|
|
648
|
-
sessionId: string;
|
|
649
|
-
type: string;
|
|
650
|
-
content: string;
|
|
651
|
-
parentEventId?: string;
|
|
652
|
-
metadata?: Record<string, unknown>;
|
|
653
|
-
}): Promise<{
|
|
654
|
-
success: boolean;
|
|
655
|
-
eventId: string;
|
|
656
|
-
sequence: number;
|
|
657
|
-
}>;
|
|
658
|
-
suspend(params: {
|
|
659
|
-
sessionId: string;
|
|
660
|
-
}): Promise<{
|
|
661
|
-
sessionId: string;
|
|
662
|
-
state: SessionState;
|
|
663
|
-
}>;
|
|
664
|
-
resume(params: {
|
|
665
|
-
sessionId: string;
|
|
666
|
-
}): Promise<{
|
|
667
|
-
sessionId: string;
|
|
668
|
-
state: SessionState;
|
|
669
|
-
}>;
|
|
670
|
-
end(params: {
|
|
671
|
-
sessionId: string;
|
|
672
|
-
}): Promise<{
|
|
673
|
-
sessionId: string;
|
|
674
|
-
state: SessionState;
|
|
675
|
-
}>;
|
|
676
|
-
archive(params: {
|
|
677
|
-
sessionId: string;
|
|
678
|
-
}): Promise<{
|
|
679
|
-
sessionId: string;
|
|
680
|
-
state: SessionState;
|
|
681
|
-
}>;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
declare class ProfileModule {
|
|
685
|
-
private readonly memory;
|
|
686
|
-
constructor(memory: MemoryModule);
|
|
687
|
-
getUserProfile(params: {
|
|
688
|
-
project?: string;
|
|
689
|
-
user_id: string;
|
|
690
|
-
include_pending?: boolean;
|
|
691
|
-
memory_types?: string;
|
|
692
|
-
}): Promise<{
|
|
693
|
-
user_id: string;
|
|
694
|
-
memories: Array<Record<string, unknown>>;
|
|
695
|
-
count: number;
|
|
696
|
-
}>;
|
|
697
|
-
getSessionMemories(params: {
|
|
698
|
-
project?: string;
|
|
699
|
-
session_id: string;
|
|
700
|
-
include_pending?: boolean;
|
|
701
|
-
limit?: number;
|
|
702
|
-
}): Promise<{
|
|
703
|
-
memories: Array<Record<string, unknown>>;
|
|
704
|
-
count: number;
|
|
705
|
-
}>;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
declare class AnalyticsModule {
|
|
709
|
-
private readonly diagnostics;
|
|
710
|
-
private readonly queue;
|
|
711
|
-
constructor(diagnostics: DiagnosticsStore, queue: WriteQueue);
|
|
712
|
-
diagnosticsSnapshot(): {
|
|
713
|
-
total: number;
|
|
714
|
-
success: number;
|
|
715
|
-
failure: number;
|
|
716
|
-
avgDurationMs: number;
|
|
717
|
-
lastTraceId?: string;
|
|
718
|
-
};
|
|
719
|
-
queueStatus(): WriteQueueStatus;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
interface AgentRunContext {
|
|
723
|
-
workspacePath?: string;
|
|
724
|
-
project?: string;
|
|
725
|
-
userId?: string;
|
|
726
|
-
sessionId?: string;
|
|
727
|
-
traceId?: string;
|
|
728
|
-
clientName?: string;
|
|
729
|
-
}
|
|
730
|
-
interface TurnInput {
|
|
731
|
-
userMessage: string;
|
|
732
|
-
taskSummary?: string;
|
|
733
|
-
touchedFiles?: string[];
|
|
734
|
-
toolContext?: string;
|
|
735
|
-
}
|
|
736
|
-
type WorkEventKind = "decision" | "constraint" | "outcome" | "failure" | "task_update" | "file_edit" | "tool_result";
|
|
737
|
-
type WorkEventSalience = "low" | "medium" | "high";
|
|
738
|
-
interface WorkEvent {
|
|
739
|
-
kind: WorkEventKind;
|
|
740
|
-
summary: string;
|
|
741
|
-
details?: string;
|
|
742
|
-
salience?: WorkEventSalience;
|
|
743
|
-
timestamp?: string;
|
|
744
|
-
filePaths?: string[];
|
|
745
|
-
toolName?: string;
|
|
746
|
-
success?: boolean;
|
|
747
|
-
}
|
|
748
|
-
interface PreparedTurn {
|
|
749
|
-
scope: AgentRunContext & {
|
|
750
|
-
project: string;
|
|
751
|
-
userId: string;
|
|
752
|
-
sessionId: string;
|
|
753
|
-
};
|
|
754
|
-
retrieval: {
|
|
755
|
-
primaryQuery: string;
|
|
756
|
-
taskFrameQuery: string | null;
|
|
757
|
-
warnings: string[];
|
|
758
|
-
degraded: boolean;
|
|
759
|
-
degradedReason?: string;
|
|
760
|
-
durationMs: number;
|
|
761
|
-
targetBudgetMs: number;
|
|
762
|
-
hardTimeoutMs: number;
|
|
763
|
-
branchStatus: Record<string, "ok" | "error" | "timeout" | "skipped">;
|
|
764
|
-
focusedScopeApplied: boolean;
|
|
765
|
-
focusedSourceIds: string[];
|
|
766
|
-
focusedFileHints: string[];
|
|
767
|
-
clientScoped: boolean;
|
|
768
|
-
fallbackUsed: boolean;
|
|
769
|
-
droppedBelowFloor: number;
|
|
770
|
-
dedupedCount: number;
|
|
771
|
-
};
|
|
772
|
-
context: string;
|
|
773
|
-
items: Array<{
|
|
774
|
-
id: string;
|
|
775
|
-
content: string;
|
|
776
|
-
type: "project" | "memory";
|
|
777
|
-
score: number;
|
|
778
|
-
sourceQuery: "primary" | "task_frame" | "bootstrap";
|
|
779
|
-
metadata?: Record<string, unknown>;
|
|
780
|
-
}>;
|
|
781
|
-
}
|
|
782
|
-
interface TurnCaptureResult {
|
|
783
|
-
success: boolean;
|
|
784
|
-
sessionIngested: boolean;
|
|
785
|
-
memoriesCreated: number;
|
|
786
|
-
relationsCreated: number;
|
|
787
|
-
invalidatedCount: number;
|
|
788
|
-
mergedCount: number;
|
|
789
|
-
droppedCount: number;
|
|
790
|
-
warnings: string[];
|
|
791
|
-
}
|
|
792
|
-
interface AgentRuntimeStatus {
|
|
793
|
-
clientName: string;
|
|
794
|
-
scope: {
|
|
795
|
-
project?: string;
|
|
796
|
-
userId?: string;
|
|
797
|
-
sessionId?: string;
|
|
798
|
-
source?: "explicit" | "workspace" | "config" | "generated";
|
|
799
|
-
warning?: string;
|
|
800
|
-
};
|
|
801
|
-
queue: {
|
|
802
|
-
queued: number;
|
|
803
|
-
flushing: boolean;
|
|
804
|
-
lastFlushAt?: string;
|
|
805
|
-
lastFlushCount: number;
|
|
806
|
-
};
|
|
807
|
-
retrieval: PreparedTurn["retrieval"] | null;
|
|
808
|
-
counters: {
|
|
809
|
-
mergedCount: number;
|
|
810
|
-
droppedCount: number;
|
|
811
|
-
bufferedLowSalience: number;
|
|
812
|
-
focusedPassHits: number;
|
|
813
|
-
fallbackTriggers: number;
|
|
814
|
-
floorDroppedCount: number;
|
|
815
|
-
injectedItemCount: number;
|
|
816
|
-
sourceScopedTurns: number;
|
|
817
|
-
broadScopedTurns: number;
|
|
818
|
-
totalTurns: number;
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
interface AgentRuntimeRankWeights {
|
|
822
|
-
focusedPassBonus?: number;
|
|
823
|
-
sourceMatchBonus?: number;
|
|
824
|
-
touchedFileBonus?: number;
|
|
825
|
-
clientMatchBonus?: number;
|
|
826
|
-
highSalienceBonus?: number;
|
|
827
|
-
mediumSalienceBonus?: number;
|
|
828
|
-
staleBroadPenalty?: number;
|
|
829
|
-
unrelatedClientPenalty?: number;
|
|
830
|
-
lowSaliencePenalty?: number;
|
|
831
|
-
}
|
|
832
|
-
interface AgentRuntimeSourceActivityOptions {
|
|
833
|
-
maxTurns?: number;
|
|
834
|
-
maxIdleMs?: number;
|
|
835
|
-
decayAfterTurns?: number;
|
|
836
|
-
decayAfterIdleMs?: number;
|
|
837
|
-
evictOnTaskSwitch?: boolean;
|
|
838
|
-
}
|
|
839
|
-
interface AgentRuntimeRetrievalOptions {
|
|
840
|
-
focusedTopK?: number;
|
|
841
|
-
broadTopK?: number;
|
|
842
|
-
minFocusedResults?: number;
|
|
843
|
-
minFocusedTopScore?: number;
|
|
844
|
-
minProjectScore?: number;
|
|
845
|
-
minMemoryScore?: number;
|
|
846
|
-
rankWeights?: AgentRuntimeRankWeights;
|
|
847
|
-
sourceActivity?: AgentRuntimeSourceActivityOptions;
|
|
848
|
-
}
|
|
849
|
-
interface AgentRuntimeOptions extends AgentRunContext {
|
|
850
|
-
topK?: number;
|
|
851
|
-
maxTokens?: number;
|
|
852
|
-
targetRetrievalMs?: number;
|
|
853
|
-
hardRetrievalTimeoutMs?: number;
|
|
854
|
-
bindingStorePath?: string;
|
|
855
|
-
recentWorkLimit?: number;
|
|
856
|
-
retrieval?: AgentRuntimeRetrievalOptions;
|
|
857
|
-
}
|
|
858
|
-
interface QueueStatus {
|
|
859
|
-
queued: number;
|
|
860
|
-
flushing: boolean;
|
|
861
|
-
lastFlushAt?: string;
|
|
862
|
-
lastFlushCount: number;
|
|
863
|
-
}
|
|
864
|
-
interface RuntimeAdapter {
|
|
865
|
-
resolveProject(project?: string): Promise<Project>;
|
|
866
|
-
query(params: QueryParams): Promise<QueryResult>;
|
|
867
|
-
ingestSession(params: {
|
|
868
|
-
project?: string;
|
|
869
|
-
session_id: string;
|
|
870
|
-
user_id?: string;
|
|
871
|
-
messages: Array<{
|
|
872
|
-
role: string;
|
|
873
|
-
content: string;
|
|
874
|
-
timestamp: string;
|
|
875
|
-
}>;
|
|
876
|
-
async?: boolean;
|
|
877
|
-
write_mode?: "async" | "sync";
|
|
878
|
-
}): Promise<{
|
|
879
|
-
success: boolean;
|
|
880
|
-
memories_created: number;
|
|
881
|
-
relations_created: number;
|
|
882
|
-
memories_invalidated: number;
|
|
883
|
-
errors?: string[];
|
|
884
|
-
} & MemoryWriteAck$1>;
|
|
885
|
-
getSessionMemories(params: {
|
|
886
|
-
project?: string;
|
|
887
|
-
session_id: string;
|
|
888
|
-
include_pending?: boolean;
|
|
889
|
-
limit?: number;
|
|
890
|
-
}): Promise<{
|
|
891
|
-
memories: Array<Record<string, unknown>>;
|
|
892
|
-
count: number;
|
|
893
|
-
}>;
|
|
894
|
-
getUserProfile(params: {
|
|
895
|
-
project?: string;
|
|
896
|
-
user_id: string;
|
|
897
|
-
include_pending?: boolean;
|
|
898
|
-
memory_types?: string;
|
|
899
|
-
}): Promise<{
|
|
900
|
-
user_id: string;
|
|
901
|
-
memories: Array<Record<string, unknown>>;
|
|
902
|
-
count: number;
|
|
903
|
-
}>;
|
|
904
|
-
searchMemories(params: {
|
|
905
|
-
project?: string;
|
|
906
|
-
query: string;
|
|
907
|
-
user_id?: string;
|
|
908
|
-
session_id?: string;
|
|
909
|
-
top_k?: number;
|
|
910
|
-
memory_type?: MemoryKind$1;
|
|
911
|
-
profile?: "fast" | "balanced" | "quality";
|
|
912
|
-
include_pending?: boolean;
|
|
913
|
-
}): Promise<MemorySearchResponse$1>;
|
|
914
|
-
addMemory(params: {
|
|
915
|
-
project?: string;
|
|
916
|
-
content: string;
|
|
917
|
-
memory_type?: MemoryKind$1;
|
|
918
|
-
user_id?: string;
|
|
919
|
-
session_id?: string;
|
|
920
|
-
importance?: number;
|
|
921
|
-
confidence?: number;
|
|
922
|
-
metadata?: Record<string, unknown>;
|
|
923
|
-
event_date?: string;
|
|
924
|
-
write_mode?: "async" | "sync";
|
|
925
|
-
async?: boolean;
|
|
926
|
-
}): Promise<MemoryWriteAck$1>;
|
|
927
|
-
queueStatus(): QueueStatus;
|
|
928
|
-
flushQueue(): Promise<void>;
|
|
929
|
-
}
|
|
930
|
-
declare class WhisperAgentRuntime {
|
|
931
|
-
private readonly args;
|
|
932
|
-
private readonly bindingStore;
|
|
933
|
-
private readonly focusedTopK;
|
|
934
|
-
private readonly broadTopK;
|
|
935
|
-
private readonly maxTokens;
|
|
936
|
-
private readonly targetRetrievalMs;
|
|
937
|
-
private readonly hardRetrievalTimeoutMs;
|
|
938
|
-
private readonly recentWorkLimit;
|
|
939
|
-
private readonly baseContext;
|
|
940
|
-
private readonly clientName;
|
|
941
|
-
private readonly minFocusedResults;
|
|
942
|
-
private readonly minFocusedTopScore;
|
|
943
|
-
private readonly minProjectScore;
|
|
944
|
-
private readonly minMemoryScore;
|
|
945
|
-
private readonly rankWeights;
|
|
946
|
-
private readonly sourceActivityOptions;
|
|
947
|
-
private bindings;
|
|
948
|
-
private touchedFiles;
|
|
949
|
-
private recentWork;
|
|
950
|
-
private recentSourceActivity;
|
|
951
|
-
private bufferedLowSalience;
|
|
952
|
-
private lastPreparedTurn;
|
|
953
|
-
private mergedCount;
|
|
954
|
-
private droppedCount;
|
|
955
|
-
private focusedPassHits;
|
|
956
|
-
private fallbackTriggers;
|
|
957
|
-
private floorDroppedCount;
|
|
958
|
-
private injectedItemCount;
|
|
959
|
-
private sourceScopedTurns;
|
|
960
|
-
private broadScopedTurns;
|
|
961
|
-
private totalTurns;
|
|
962
|
-
private currentTurn;
|
|
963
|
-
private lastTaskSummary;
|
|
964
|
-
private lastScope;
|
|
965
|
-
constructor(args: {
|
|
966
|
-
baseContext: AgentRunContext;
|
|
967
|
-
options: AgentRuntimeOptions;
|
|
968
|
-
adapter: RuntimeAdapter;
|
|
969
|
-
});
|
|
970
|
-
private getBindings;
|
|
971
|
-
private pushTouchedFiles;
|
|
972
|
-
private pushWorkEvent;
|
|
973
|
-
noteSourceActivity(sourceIds?: string[]): void;
|
|
974
|
-
private refreshTaskSummary;
|
|
975
|
-
private activeSourceIds;
|
|
976
|
-
private focusedScope;
|
|
977
|
-
private exactFileMetadataFilter;
|
|
978
|
-
private makeTaskFrameQuery;
|
|
979
|
-
private resolveScope;
|
|
980
|
-
private runBranch;
|
|
981
|
-
private contextItems;
|
|
982
|
-
private memoryItems;
|
|
983
|
-
private stableItemKey;
|
|
984
|
-
private metadataStrings;
|
|
985
|
-
private hasSourceMatch;
|
|
986
|
-
private hasFileMatch;
|
|
987
|
-
private hasClientMatch;
|
|
988
|
-
private salienceAdjustment;
|
|
989
|
-
private narrowFocusedMemories;
|
|
990
|
-
private applyRelevanceFloor;
|
|
991
|
-
private rerank;
|
|
992
|
-
private buildContext;
|
|
993
|
-
bootstrap(context?: Partial<AgentRunContext>): Promise<PreparedTurn>;
|
|
994
|
-
beforeTurn(input: TurnInput, context?: Partial<AgentRunContext>): Promise<PreparedTurn>;
|
|
995
|
-
recordWork(event: WorkEvent, context?: Partial<AgentRunContext>): Promise<MemoryWriteAck$1 | {
|
|
996
|
-
success: true;
|
|
997
|
-
buffered: true;
|
|
998
|
-
}>;
|
|
999
|
-
private resolveLearningScope;
|
|
1000
|
-
afterTurn(input: TurnInput & {
|
|
1001
|
-
assistantMessage: string;
|
|
1002
|
-
auto_learn?: boolean;
|
|
1003
|
-
}, context?: Partial<AgentRunContext>): Promise<TurnCaptureResult>;
|
|
1004
|
-
flush(reason?: string, context?: Partial<AgentRunContext>): Promise<AgentRuntimeStatus>;
|
|
1005
|
-
status(): AgentRuntimeStatus;
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
interface WhisperClientConfig {
|
|
1009
|
-
apiKey: string;
|
|
1010
|
-
baseUrl?: string;
|
|
1011
|
-
project?: string;
|
|
1012
|
-
compatMode?: CompatMode;
|
|
1013
|
-
fetch?: typeof fetch;
|
|
1014
|
-
timeouts?: Partial<TimeoutBudgets>;
|
|
1015
|
-
retryPolicy?: RetryPolicy;
|
|
1016
|
-
cache?: {
|
|
1017
|
-
enabled?: boolean;
|
|
1018
|
-
ttlMs?: number;
|
|
1019
|
-
capacity?: number;
|
|
1020
|
-
};
|
|
1021
|
-
queue?: {
|
|
1022
|
-
enabled?: boolean;
|
|
1023
|
-
maxBatchSize?: number;
|
|
1024
|
-
flushIntervalMs?: number;
|
|
1025
|
-
maxAttempts?: number;
|
|
1026
|
-
persistence?: "memory" | "storage" | "file";
|
|
1027
|
-
filePath?: string;
|
|
1028
|
-
};
|
|
1029
|
-
telemetry?: {
|
|
1030
|
-
enabled?: boolean;
|
|
1031
|
-
maxEntries?: number;
|
|
1032
|
-
};
|
|
1033
|
-
}
|
|
1034
|
-
interface RunContext {
|
|
1035
|
-
project?: string;
|
|
1036
|
-
userId?: string;
|
|
1037
|
-
sessionId?: string;
|
|
1038
|
-
traceId?: string;
|
|
1039
|
-
}
|
|
1040
|
-
declare class WhisperClient {
|
|
1041
|
-
private readonly config;
|
|
1042
|
-
readonly diagnostics: {
|
|
1043
|
-
getLast: (limit?: number) => ReturnType<DiagnosticsStore["getLast"]>;
|
|
1044
|
-
subscribe: (fn: Parameters<DiagnosticsStore["subscribe"]>[0]) => ReturnType<DiagnosticsStore["subscribe"]>;
|
|
1045
|
-
snapshot: () => ReturnType<DiagnosticsStore["snapshot"]>;
|
|
1046
|
-
};
|
|
1047
|
-
readonly queue: {
|
|
1048
|
-
flush: () => Promise<void>;
|
|
1049
|
-
status: () => ReturnType<WriteQueue["status"]>;
|
|
1050
|
-
};
|
|
1051
|
-
readonly memory: {
|
|
1052
|
-
add: (params: Parameters<MemoryModule["add"]>[0]) => Promise<MemoryWriteAck$1>;
|
|
1053
|
-
addBulk: (params: Parameters<MemoryModule["addBulk"]>[0]) => Promise<MemoryWriteAck$1>;
|
|
1054
|
-
search: (params: Parameters<MemoryModule["search"]>[0]) => Promise<MemorySearchResponse$1>;
|
|
1055
|
-
get: (memoryId: string) => Promise<{
|
|
1056
|
-
memory: Record<string, unknown>;
|
|
1057
|
-
}>;
|
|
1058
|
-
getUserProfile: (params: Parameters<MemoryModule["getUserProfile"]>[0]) => ReturnType<MemoryModule["getUserProfile"]>;
|
|
1059
|
-
getSessionMemories: (params: Parameters<MemoryModule["getSessionMemories"]>[0]) => ReturnType<MemoryModule["getSessionMemories"]>;
|
|
1060
|
-
update: (memoryId: string, params: {
|
|
1061
|
-
content: string;
|
|
1062
|
-
reasoning?: string;
|
|
1063
|
-
}) => Promise<{
|
|
1064
|
-
success: boolean;
|
|
1065
|
-
}>;
|
|
1066
|
-
delete: (memoryId: string) => Promise<{
|
|
1067
|
-
success: boolean;
|
|
1068
|
-
deleted: string;
|
|
1069
|
-
}>;
|
|
1070
|
-
flag: (params: {
|
|
1071
|
-
memoryId: string;
|
|
1072
|
-
reason: string;
|
|
1073
|
-
severity?: "low" | "medium" | "high";
|
|
1074
|
-
}) => Promise<{
|
|
1075
|
-
success: boolean;
|
|
1076
|
-
}>;
|
|
1077
|
-
};
|
|
1078
|
-
readonly session: {
|
|
1079
|
-
start: (params: Parameters<SessionModule["start"]>[0]) => ReturnType<SessionModule["start"]>;
|
|
1080
|
-
event: (params: Parameters<SessionModule["event"]>[0]) => ReturnType<SessionModule["event"]>;
|
|
1081
|
-
suspend: (params: Parameters<SessionModule["suspend"]>[0]) => ReturnType<SessionModule["suspend"]>;
|
|
1082
|
-
resume: (params: Parameters<SessionModule["resume"]>[0]) => ReturnType<SessionModule["resume"]>;
|
|
1083
|
-
end: (params: Parameters<SessionModule["end"]>[0]) => ReturnType<SessionModule["end"]>;
|
|
1084
|
-
};
|
|
1085
|
-
readonly profile: {
|
|
1086
|
-
getUserProfile: (params: Parameters<ProfileModule["getUserProfile"]>[0]) => ReturnType<ProfileModule["getUserProfile"]>;
|
|
1087
|
-
getSessionMemories: (params: Parameters<ProfileModule["getSessionMemories"]>[0]) => ReturnType<ProfileModule["getSessionMemories"]>;
|
|
1088
|
-
};
|
|
1089
|
-
readonly analytics: {
|
|
1090
|
-
diagnosticsSnapshot: () => ReturnType<AnalyticsModule["diagnosticsSnapshot"]>;
|
|
1091
|
-
queueStatus: () => ReturnType<AnalyticsModule["queueStatus"]>;
|
|
1092
|
-
};
|
|
1093
|
-
private readonly runtimeClient;
|
|
1094
|
-
private readonly diagnosticsStore;
|
|
1095
|
-
private readonly searchCache;
|
|
1096
|
-
private readonly writeQueue;
|
|
1097
|
-
private readonly memoryModule;
|
|
1098
|
-
private readonly sessionModule;
|
|
1099
|
-
private readonly profileModule;
|
|
1100
|
-
private readonly analyticsModule;
|
|
1101
|
-
private readonly projectRefToId;
|
|
1102
|
-
private projectCache;
|
|
1103
|
-
private projectCacheExpiresAt;
|
|
1104
|
-
constructor(config: WhisperClientConfig);
|
|
1105
|
-
static fromEnv(overrides?: Partial<WhisperClientConfig>): WhisperClient;
|
|
1106
|
-
private createQueueStore;
|
|
1107
|
-
private defaultQueuePersistence;
|
|
1108
|
-
private defaultQueueFilePath;
|
|
1109
|
-
private getRequiredProject;
|
|
1110
|
-
private refreshProjectCache;
|
|
1111
|
-
private fetchResolvedProject;
|
|
1112
|
-
resolveProject(projectRef?: string): Promise<Project>;
|
|
1113
|
-
query(params: QueryParams): Promise<QueryResult>;
|
|
1114
|
-
ingestSession(params: {
|
|
1115
|
-
project?: string;
|
|
1116
|
-
session_id: string;
|
|
1117
|
-
user_id?: string;
|
|
1118
|
-
messages: Array<{
|
|
1119
|
-
role: string;
|
|
1120
|
-
content: string;
|
|
1121
|
-
timestamp: string;
|
|
1122
|
-
}>;
|
|
1123
|
-
async?: boolean;
|
|
1124
|
-
write_mode?: "async" | "sync";
|
|
1125
|
-
}): Promise<{
|
|
1126
|
-
success: boolean;
|
|
1127
|
-
memories_created: number;
|
|
1128
|
-
relations_created: number;
|
|
1129
|
-
memories_invalidated: number;
|
|
1130
|
-
errors?: string[];
|
|
1131
|
-
} & MemoryWriteAck$1>;
|
|
1132
|
-
learn(params: LearnInput): Promise<LearnResult>;
|
|
1133
|
-
createAgentRuntime(options?: AgentRuntimeOptions): WhisperAgentRuntime;
|
|
1134
|
-
withRunContext(context: RunContext): {
|
|
1135
|
-
memory: {
|
|
1136
|
-
add: (params: Omit<Parameters<MemoryModule["add"]>[0], "project" | "user_id" | "session_id"> & {
|
|
1137
|
-
project?: string;
|
|
1138
|
-
user_id?: string;
|
|
1139
|
-
session_id?: string;
|
|
1140
|
-
memory_type?: MemoryKind$1;
|
|
1141
|
-
}) => Promise<MemoryWriteAck$1>;
|
|
1142
|
-
search: (params: Omit<Parameters<MemoryModule["search"]>[0], "project" | "user_id" | "session_id"> & {
|
|
1143
|
-
project?: string;
|
|
1144
|
-
user_id?: string;
|
|
1145
|
-
session_id?: string;
|
|
1146
|
-
}) => Promise<MemorySearchResponse$1>;
|
|
1147
|
-
};
|
|
1148
|
-
session: {
|
|
1149
|
-
event: (params: Omit<Parameters<SessionModule["event"]>[0], "sessionId"> & {
|
|
1150
|
-
sessionId?: string;
|
|
1151
|
-
}) => Promise<{
|
|
1152
|
-
success: boolean;
|
|
1153
|
-
eventId: string;
|
|
1154
|
-
sequence: number;
|
|
1155
|
-
}>;
|
|
1156
|
-
};
|
|
1157
|
-
learn: (params: LearnInput) => Promise<LearnResult>;
|
|
1158
|
-
queue: {
|
|
1159
|
-
flush: () => Promise<void>;
|
|
1160
|
-
status: () => ReturnType<WriteQueue["status"]>;
|
|
1161
|
-
};
|
|
1162
|
-
diagnostics: {
|
|
1163
|
-
getLast: (limit?: number) => ReturnType<DiagnosticsStore["getLast"]>;
|
|
1164
|
-
subscribe: (fn: Parameters<DiagnosticsStore["subscribe"]>[0]) => ReturnType<DiagnosticsStore["subscribe"]>;
|
|
1165
|
-
snapshot: () => ReturnType<DiagnosticsStore["snapshot"]>;
|
|
1166
|
-
};
|
|
1167
|
-
};
|
|
1168
|
-
shutdown(): Promise<void>;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
interface AgentMiddlewareConfig extends WhisperOptions {
|
|
1172
|
-
/**
|
|
1173
|
-
* Build the prompt passed to the model.
|
|
1174
|
-
*/
|
|
1175
|
-
promptBuilder?: (params: {
|
|
1176
|
-
context: string;
|
|
1177
|
-
userMessage: string;
|
|
1178
|
-
}) => string;
|
|
1179
|
-
}
|
|
1180
|
-
interface AgentTurnParams {
|
|
1181
|
-
userMessage: string;
|
|
1182
|
-
userId?: string;
|
|
1183
|
-
sessionId?: string;
|
|
1184
|
-
project?: string;
|
|
1185
|
-
contextLimit?: number;
|
|
1186
|
-
auto_learn?: boolean;
|
|
1187
|
-
}
|
|
1188
|
-
interface AgentTurnResult {
|
|
1189
|
-
prompt: string;
|
|
1190
|
-
context: string;
|
|
1191
|
-
contextCount: number;
|
|
1192
|
-
}
|
|
1193
|
-
interface WrappedGenerateResult {
|
|
1194
|
-
response: string;
|
|
1195
|
-
prompt: string;
|
|
1196
|
-
context: string;
|
|
1197
|
-
contextCount: number;
|
|
1198
|
-
extracted: number;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Drop-in middleware for existing AI agents.
|
|
1202
|
-
*
|
|
1203
|
-
* Typical flow:
|
|
1204
|
-
* 1) beforeTurn -> retrieve context
|
|
1205
|
-
* 2) call your model
|
|
1206
|
-
* 3) afterTurn -> store memories
|
|
1207
|
-
*/
|
|
1208
|
-
declare class WhisperAgentMiddleware {
|
|
1209
|
-
private readonly whisper;
|
|
1210
|
-
private readonly promptBuilder;
|
|
1211
|
-
constructor(config: AgentMiddlewareConfig);
|
|
1212
|
-
beforeTurn(params: AgentTurnParams): Promise<AgentTurnResult>;
|
|
1213
|
-
afterTurn(params: {
|
|
1214
|
-
userMessage: string;
|
|
1215
|
-
assistantMessage: string;
|
|
1216
|
-
userId?: string;
|
|
1217
|
-
sessionId?: string;
|
|
1218
|
-
project?: string;
|
|
1219
|
-
auto_learn?: boolean;
|
|
1220
|
-
}): Promise<{
|
|
1221
|
-
success: boolean;
|
|
1222
|
-
extracted: number;
|
|
1223
|
-
}>;
|
|
1224
|
-
wrapGenerate(params: AgentTurnParams & {
|
|
1225
|
-
generate: (prompt: string) => Promise<string>;
|
|
1226
|
-
}): Promise<WrappedGenerateResult>;
|
|
1227
|
-
raw(): Whisper;
|
|
1228
|
-
}
|
|
1229
|
-
declare function createAgentMiddleware(config: AgentMiddlewareConfig): WhisperAgentMiddleware;
|
|
1230
|
-
|
|
1231
|
-
interface LangChainMemoryAdapterOptions {
|
|
1232
|
-
project?: string;
|
|
1233
|
-
userId: string;
|
|
1234
|
-
sessionId?: string;
|
|
1235
|
-
memoryKey?: string;
|
|
1236
|
-
topK?: number;
|
|
1237
|
-
profile?: "fast" | "balanced" | "quality";
|
|
1238
|
-
}
|
|
1239
|
-
/**
|
|
1240
|
-
* Lightweight adapter matching LangChain memory contract shape.
|
|
1241
|
-
* Compatible with BaseMemory-style integrations:
|
|
1242
|
-
* - loadMemoryVariables
|
|
1243
|
-
* - saveContext
|
|
1244
|
-
* - clear
|
|
1245
|
-
*/
|
|
1246
|
-
declare class LangChainMemoryAdapter {
|
|
1247
|
-
private readonly client;
|
|
1248
|
-
private readonly options;
|
|
1249
|
-
readonly memoryKeys: string[];
|
|
1250
|
-
private readonly memoryKey;
|
|
1251
|
-
constructor(client: WhisperClient, options: LangChainMemoryAdapterOptions);
|
|
1252
|
-
loadMemoryVariables(_inputValues: Record<string, unknown>): Promise<Record<string, string>>;
|
|
1253
|
-
saveContext(inputValues: Record<string, unknown>, outputValues: Record<string, unknown>): Promise<void>;
|
|
1254
|
-
clear(): Promise<void>;
|
|
1255
|
-
}
|
|
1256
|
-
declare function createLangChainMemoryAdapter(client: WhisperClient, options: LangChainMemoryAdapterOptions): LangChainMemoryAdapter;
|
|
1257
|
-
|
|
1258
|
-
interface LangGraphCheckpointConfig {
|
|
1259
|
-
configurable: {
|
|
1260
|
-
thread_id: string;
|
|
1261
|
-
checkpoint_ns?: string;
|
|
1262
|
-
checkpoint_id?: string;
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
interface LangGraphCheckpointTuple {
|
|
1266
|
-
config: LangGraphCheckpointConfig;
|
|
1267
|
-
checkpoint: Record<string, unknown>;
|
|
1268
|
-
metadata?: Record<string, unknown>;
|
|
1269
|
-
parent_config?: LangGraphCheckpointConfig | null;
|
|
1270
|
-
}
|
|
1271
|
-
interface LangGraphCheckpointListOptions {
|
|
1272
|
-
limit?: number;
|
|
1273
|
-
before?: {
|
|
1274
|
-
checkpointId?: string;
|
|
1275
|
-
updatedAt?: string;
|
|
1276
|
-
};
|
|
1277
|
-
sort?: "asc" | "desc";
|
|
1278
|
-
filter?: {
|
|
1279
|
-
checkpointNs?: string;
|
|
1280
|
-
metadata?: Record<string, unknown>;
|
|
1281
|
-
};
|
|
1282
|
-
}
|
|
1283
|
-
interface LangGraphCheckpointSearchOptions {
|
|
1284
|
-
threadId: string;
|
|
1285
|
-
query: string;
|
|
1286
|
-
checkpointNs?: string;
|
|
1287
|
-
topK?: number;
|
|
1288
|
-
includePending?: boolean;
|
|
1289
|
-
profile?: "fast" | "balanced" | "quality";
|
|
1290
|
-
}
|
|
1291
|
-
interface LangGraphCheckpointAdapterOptions {
|
|
1292
|
-
project?: string;
|
|
1293
|
-
userIdPrefix?: string;
|
|
1294
|
-
defaultCheckpointNs?: string;
|
|
1295
|
-
}
|
|
1296
|
-
/**
|
|
1297
|
-
* LangGraph checkpoint adapter over Whisper memory APIs.
|
|
1298
|
-
* Phase 5a: get/put/list.
|
|
1299
|
-
* Phase 5b: checkpoint_ns fidelity, richer list/search filtering, schema-hard parsing.
|
|
1300
|
-
*/
|
|
1301
|
-
declare class LangGraphCheckpointAdapter {
|
|
1302
|
-
private readonly client;
|
|
1303
|
-
private readonly localByKey;
|
|
1304
|
-
private readonly localByThread;
|
|
1305
|
-
private readonly options;
|
|
1306
|
-
constructor(client: WhisperClient, options?: LangGraphCheckpointAdapterOptions);
|
|
1307
|
-
private getUserId;
|
|
1308
|
-
private resolveCheckpointNs;
|
|
1309
|
-
private makeLocalKey;
|
|
1310
|
-
private normalizeTuple;
|
|
1311
|
-
private parseCheckpointTupleFromRow;
|
|
1312
|
-
private upsertLocal;
|
|
1313
|
-
private mergeWithLocal;
|
|
1314
|
-
private applyListFilters;
|
|
1315
|
-
private fetchThreadRecords;
|
|
1316
|
-
get(config: LangGraphCheckpointConfig): Promise<LangGraphCheckpointTuple | undefined>;
|
|
1317
|
-
put(config: LangGraphCheckpointConfig, checkpoint: Record<string, unknown>, metadata?: Record<string, unknown>, parentConfig?: LangGraphCheckpointConfig | null): Promise<LangGraphCheckpointConfig>;
|
|
1318
|
-
list(config: LangGraphCheckpointConfig, options?: LangGraphCheckpointListOptions): Promise<LangGraphCheckpointTuple[]>;
|
|
1319
|
-
search(params: LangGraphCheckpointSearchOptions): Promise<LangGraphCheckpointTuple[]>;
|
|
1320
|
-
}
|
|
1321
|
-
declare function createLangGraphCheckpointAdapter(client: WhisperClient, options?: LangGraphCheckpointAdapterOptions): LangGraphCheckpointAdapter;
|
|
1322
|
-
|
|
1323
|
-
interface MemoryGraphNode {
|
|
1324
|
-
id: string;
|
|
1325
|
-
label?: string;
|
|
1326
|
-
memory_type?: string;
|
|
1327
|
-
}
|
|
1328
|
-
interface MemoryGraphEdge {
|
|
1329
|
-
source: string;
|
|
1330
|
-
target: string;
|
|
1331
|
-
type?: string;
|
|
1332
|
-
}
|
|
1333
|
-
interface MemoryGraphPayload {
|
|
1334
|
-
nodes: MemoryGraphNode[];
|
|
1335
|
-
edges: MemoryGraphEdge[];
|
|
1336
|
-
}
|
|
1337
|
-
/**
|
|
1338
|
-
* Convert memory graph payload to Mermaid flowchart syntax.
|
|
1339
|
-
* Useful for quick visualization in docs/dashboards.
|
|
1340
|
-
*/
|
|
1341
|
-
declare function memoryGraphToMermaid(graph: MemoryGraphPayload): string;
|
|
1342
|
-
|
|
1343
|
-
interface WhisperConfig {
|
|
1344
|
-
apiKey: string;
|
|
1345
|
-
baseUrl?: string;
|
|
1346
|
-
project?: string;
|
|
1347
|
-
timeoutMs?: number;
|
|
1348
|
-
retry?: {
|
|
1349
|
-
maxAttempts?: number;
|
|
1350
|
-
baseDelayMs?: number;
|
|
1351
|
-
maxDelayMs?: number;
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
interface QueryParams {
|
|
1355
|
-
project?: string;
|
|
1356
|
-
query: string;
|
|
1357
|
-
top_k?: number;
|
|
1358
|
-
threshold?: number;
|
|
1359
|
-
chunk_types?: string[];
|
|
1360
|
-
source_ids?: string[];
|
|
1361
|
-
metadata_filter?: Record<string, any>;
|
|
1362
|
-
hybrid?: boolean;
|
|
1363
|
-
vector_weight?: number;
|
|
1364
|
-
bm25_weight?: number;
|
|
1365
|
-
rerank?: boolean;
|
|
1366
|
-
include_memories?: boolean;
|
|
1367
|
-
user_id?: string;
|
|
1368
|
-
session_id?: string;
|
|
1369
|
-
agent_id?: string;
|
|
1370
|
-
include_graph?: boolean;
|
|
1371
|
-
graph_depth?: number;
|
|
1372
|
-
max_tokens?: number;
|
|
1373
|
-
compress?: boolean;
|
|
1374
|
-
compression_strategy?: "summarize" | "extract" | "delta" | "adaptive";
|
|
1375
|
-
use_cache?: boolean;
|
|
1376
|
-
include_parent_content?: boolean;
|
|
1377
|
-
retrieval_profile?: "legacy" | "precision_v1";
|
|
1378
|
-
}
|
|
1379
|
-
interface QueryResult {
|
|
1380
|
-
results: Array<{
|
|
1381
|
-
id: string;
|
|
1382
|
-
content: string;
|
|
1383
|
-
score: number;
|
|
1384
|
-
metadata: Record<string, any>;
|
|
1385
|
-
source: string;
|
|
1386
|
-
document: string;
|
|
1387
|
-
type: string;
|
|
1388
|
-
retrieval_source: string;
|
|
1389
|
-
}>;
|
|
1390
|
-
context: string;
|
|
1391
|
-
meta: {
|
|
1392
|
-
query: string;
|
|
1393
|
-
total: number;
|
|
1394
|
-
latency_ms: number;
|
|
1395
|
-
cache_hit: boolean;
|
|
1396
|
-
tokens_used: number;
|
|
1397
|
-
context_hash: string;
|
|
1398
|
-
source_scope?: {
|
|
1399
|
-
mode: "none" | "explicit" | "auto";
|
|
1400
|
-
source_ids: string[];
|
|
1401
|
-
host?: string;
|
|
1402
|
-
matched_sources?: number;
|
|
1403
|
-
};
|
|
1404
|
-
profile?: string;
|
|
1405
|
-
retrieval_profile?: "legacy" | "precision_v1";
|
|
1406
|
-
compression?: any;
|
|
1407
|
-
timing?: {
|
|
1408
|
-
cache_check_ms?: number;
|
|
1409
|
-
embed_ms?: number;
|
|
1410
|
-
vector_ms?: number;
|
|
1411
|
-
fts_ms?: number;
|
|
1412
|
-
rerank_ms?: number;
|
|
1413
|
-
enrich_ms?: number;
|
|
1414
|
-
pack_ms?: number;
|
|
1415
|
-
cache_set_ms?: number;
|
|
1416
|
-
total_ms?: number;
|
|
1417
|
-
[key: string]: number | undefined;
|
|
1418
|
-
};
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
interface Project {
|
|
1422
|
-
id: string;
|
|
1423
|
-
orgId: string;
|
|
1424
|
-
name: string;
|
|
1425
|
-
slug: string;
|
|
1426
|
-
description?: string;
|
|
1427
|
-
settings?: Record<string, any>;
|
|
1428
|
-
createdAt: string;
|
|
1429
|
-
updatedAt: string;
|
|
1430
|
-
}
|
|
1431
|
-
interface Source {
|
|
1432
|
-
id: string;
|
|
1433
|
-
projectId: string;
|
|
1434
|
-
name: string;
|
|
1435
|
-
connectorType: string;
|
|
1436
|
-
config: Record<string, any>;
|
|
1437
|
-
status: string;
|
|
1438
|
-
syncSchedule?: string;
|
|
1439
|
-
lastSyncAt?: string;
|
|
1440
|
-
syncError?: string;
|
|
1441
|
-
createdAt: string;
|
|
1442
|
-
updatedAt: string;
|
|
1443
|
-
}
|
|
1444
|
-
interface VideoSourceMetadata {
|
|
1445
|
-
source_kind: "video";
|
|
1446
|
-
video_url: string;
|
|
1447
|
-
platform: "youtube" | "loom" | "generic";
|
|
1448
|
-
duration_seconds?: number;
|
|
1449
|
-
published_at?: string;
|
|
1450
|
-
channel_or_author?: string;
|
|
1451
|
-
}
|
|
1452
|
-
interface VideoIngestionStatus {
|
|
1453
|
-
source_id: string;
|
|
1454
|
-
status: string;
|
|
1455
|
-
stage: "extracting" | "transcribing" | "segmenting" | "enriching" | "indexing" | "completed" | "failed";
|
|
1456
|
-
sync_job_id?: string | null;
|
|
1457
|
-
progress?: {
|
|
1458
|
-
current: number;
|
|
1459
|
-
total: number;
|
|
1460
|
-
message: string;
|
|
1461
|
-
} | null;
|
|
1462
|
-
duration_seconds?: number | null;
|
|
1463
|
-
chunks_indexed?: number | null;
|
|
1464
|
-
decisions_detected?: number | null;
|
|
1465
|
-
entities_extracted?: string[];
|
|
1466
|
-
last_error?: string | null;
|
|
1467
|
-
updated_at?: string;
|
|
1468
|
-
}
|
|
1469
|
-
type CanonicalSourceType = "github" | "web" | "playwright" | "pdf" | "local" | "slack" | "video";
|
|
1470
|
-
interface CanonicalSourceCreateParams {
|
|
1471
|
-
type: CanonicalSourceType;
|
|
1472
|
-
name?: string;
|
|
1473
|
-
auto_index?: boolean;
|
|
1474
|
-
metadata?: Record<string, string>;
|
|
1475
|
-
ingestion_profile?: "auto" | "repo" | "web_docs" | "pdf_layout" | "video_transcript" | "plain_text";
|
|
1476
|
-
strategy_override?: "fixed" | "recursive" | "semantic" | "hierarchical" | "adaptive";
|
|
1477
|
-
profile_config?: Record<string, any>;
|
|
1478
|
-
owner?: string;
|
|
1479
|
-
repo?: string;
|
|
1480
|
-
branch?: string;
|
|
1481
|
-
paths?: string[];
|
|
1482
|
-
url?: string;
|
|
1483
|
-
crawl_depth?: number;
|
|
1484
|
-
include_paths?: string[];
|
|
1485
|
-
exclude_paths?: string[];
|
|
1486
|
-
file_path?: string;
|
|
1487
|
-
path?: string;
|
|
1488
|
-
glob?: string;
|
|
1489
|
-
max_files?: number;
|
|
1490
|
-
max_pages?: number;
|
|
1491
|
-
extract_mode?: "text" | "structured" | "markdown";
|
|
1492
|
-
workspace_id?: string;
|
|
1493
|
-
channel_ids?: string[];
|
|
1494
|
-
since?: string;
|
|
1495
|
-
token?: string;
|
|
1496
|
-
auth_ref?: string;
|
|
1497
|
-
platform?: "youtube" | "loom" | "generic";
|
|
1498
|
-
language?: string;
|
|
1499
|
-
allow_stt_fallback?: boolean;
|
|
1500
|
-
max_duration_minutes?: number;
|
|
1501
|
-
max_chunks?: number;
|
|
1502
|
-
}
|
|
1503
|
-
interface CanonicalSourceCreateResult {
|
|
1504
|
-
source_id: string;
|
|
1505
|
-
status: "queued" | "indexing" | "ready" | "failed";
|
|
1506
|
-
job_id: string | null;
|
|
1507
|
-
index_started: boolean;
|
|
1508
|
-
warnings: string[];
|
|
1509
|
-
}
|
|
1510
|
-
interface Memory {
|
|
1511
|
-
id: string;
|
|
1512
|
-
projectId: string;
|
|
1513
|
-
content: string;
|
|
1514
|
-
memoryType: "factual" | "episodic" | "semantic" | "procedural";
|
|
1515
|
-
userId?: string;
|
|
1516
|
-
sessionId?: string;
|
|
1517
|
-
agentId?: string;
|
|
1518
|
-
importance: number;
|
|
1519
|
-
metadata: Record<string, any>;
|
|
1520
|
-
accessCount: number;
|
|
1521
|
-
createdAt: string;
|
|
1522
|
-
updatedAt: string;
|
|
1523
|
-
}
|
|
1524
|
-
type MemoryKind = "factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
1525
|
-
interface ExtractedMemory {
|
|
1526
|
-
content: string;
|
|
1527
|
-
memoryType: MemoryKind;
|
|
1528
|
-
entityMentions: string[];
|
|
1529
|
-
eventDate: string | null;
|
|
1530
|
-
confidence: number;
|
|
1531
|
-
reasoning?: string;
|
|
1532
|
-
inferred?: boolean;
|
|
1533
|
-
}
|
|
1534
|
-
interface MemoryExtractionResult {
|
|
1535
|
-
explicit: ExtractedMemory[];
|
|
1536
|
-
implicit: ExtractedMemory[];
|
|
1537
|
-
all: ExtractedMemory[];
|
|
1538
|
-
extractionMethod: "pattern" | "inference" | "hybrid" | "skipped";
|
|
1539
|
-
latencyMs: number;
|
|
1540
|
-
}
|
|
1541
|
-
interface MemoryLatencyBreakdown {
|
|
1542
|
-
cache_ms: number;
|
|
1543
|
-
embed_ms: number;
|
|
1544
|
-
vector_ms: number;
|
|
1545
|
-
lexical_ms: number;
|
|
1546
|
-
merge_ms: number;
|
|
1547
|
-
total_ms: number;
|
|
1548
|
-
}
|
|
1549
|
-
interface MemorySearchResponse {
|
|
1550
|
-
results: Array<{
|
|
1551
|
-
memory: {
|
|
1552
|
-
id: string;
|
|
1553
|
-
content: string;
|
|
1554
|
-
type: string;
|
|
1555
|
-
entities?: string[];
|
|
1556
|
-
confidence?: number;
|
|
1557
|
-
version?: number;
|
|
1558
|
-
temporal?: {
|
|
1559
|
-
document_date?: string | null;
|
|
1560
|
-
event_date?: string | null;
|
|
1561
|
-
valid_from?: string | null;
|
|
1562
|
-
valid_until?: string | null;
|
|
1563
|
-
};
|
|
1564
|
-
};
|
|
1565
|
-
chunk?: {
|
|
1566
|
-
id: string;
|
|
1567
|
-
content: string;
|
|
1568
|
-
metadata?: Record<string, any>;
|
|
1569
|
-
};
|
|
1570
|
-
similarity: number;
|
|
1571
|
-
relations?: any[];
|
|
1572
|
-
}>;
|
|
1573
|
-
count: number;
|
|
1574
|
-
query: string;
|
|
1575
|
-
trace_id?: string;
|
|
1576
|
-
question_date?: string;
|
|
1577
|
-
latency_ms?: number;
|
|
1578
|
-
latency_breakdown?: MemoryLatencyBreakdown;
|
|
1579
|
-
fallback?: "vector" | "lexical";
|
|
1580
|
-
mode?: "fast" | "balanced" | "quality";
|
|
1581
|
-
profile?: "fast" | "balanced" | "quality";
|
|
1582
|
-
include_pending?: boolean;
|
|
1583
|
-
pending_overlay_count?: number;
|
|
1584
|
-
}
|
|
1585
|
-
interface MemoryWriteAck {
|
|
1586
|
-
success: boolean;
|
|
1587
|
-
mode?: "async" | "sync";
|
|
1588
|
-
trace_id?: string;
|
|
1589
|
-
job_id?: string;
|
|
1590
|
-
status_url?: string;
|
|
1591
|
-
accepted_at?: string;
|
|
1592
|
-
visibility_sla_ms?: number;
|
|
1593
|
-
pending_visibility?: boolean;
|
|
1594
|
-
[key: string]: any;
|
|
1595
|
-
}
|
|
1596
|
-
interface MemoryWriteResult {
|
|
1597
|
-
id: string;
|
|
1598
|
-
success: boolean;
|
|
1599
|
-
path: "sota" | "legacy";
|
|
1600
|
-
fallback_used: boolean;
|
|
1601
|
-
mode?: "async" | "sync";
|
|
1602
|
-
memory_id?: string;
|
|
1603
|
-
job_id?: string;
|
|
1604
|
-
status_url?: string;
|
|
1605
|
-
accepted_at?: string;
|
|
1606
|
-
visibility_sla_ms?: number;
|
|
1607
|
-
pending_visibility?: boolean;
|
|
1608
|
-
semantic_status?: "pending" | "ready";
|
|
1609
|
-
}
|
|
1610
|
-
type WhisperErrorCode = "INVALID_API_KEY" | "PROJECT_NOT_FOUND" | "PROJECT_AMBIGUOUS" | "RATE_LIMITED" | "TEMPORARY_UNAVAILABLE" | "NETWORK_ERROR" | "TIMEOUT" | "REQUEST_FAILED" | "MISSING_PROJECT";
|
|
1611
|
-
declare class WhisperError extends Error {
|
|
1612
|
-
code: WhisperErrorCode;
|
|
1613
|
-
status?: number;
|
|
1614
|
-
retryable: boolean;
|
|
1615
|
-
details?: unknown;
|
|
1616
|
-
constructor(args: {
|
|
1617
|
-
code: WhisperErrorCode;
|
|
1618
|
-
message: string;
|
|
1619
|
-
status?: number;
|
|
1620
|
-
retryable?: boolean;
|
|
1621
|
-
details?: unknown;
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
declare class WhisperContext {
|
|
1625
|
-
private apiKey;
|
|
1626
|
-
private baseUrl;
|
|
1627
|
-
private defaultProject?;
|
|
1628
|
-
private timeoutMs;
|
|
1629
|
-
private retryConfig;
|
|
1630
|
-
private runtimeClient;
|
|
1631
|
-
private projectRefToId;
|
|
1632
|
-
private projectCache;
|
|
1633
|
-
private projectCacheExpiresAt;
|
|
1634
|
-
constructor(config: WhisperConfig);
|
|
1635
|
-
withProject(project: string): WhisperContext;
|
|
1636
|
-
private getRequiredProject;
|
|
1637
|
-
private refreshProjectCache;
|
|
1638
|
-
private fetchResolvedProject;
|
|
1639
|
-
resolveProject(projectRef?: string): Promise<Project>;
|
|
1640
|
-
private resolveProjectId;
|
|
1641
|
-
private getProjectRefCandidates;
|
|
1642
|
-
private withProjectRefFallback;
|
|
1643
|
-
private shouldRetryWithResolvedProjectId;
|
|
1644
|
-
private withProjectPathFallback;
|
|
1645
|
-
private classifyError;
|
|
1646
|
-
private isEndpointNotFoundError;
|
|
1647
|
-
private inferOperation;
|
|
1648
|
-
private request;
|
|
1649
|
-
query(params: QueryParams): Promise<QueryResult>;
|
|
1650
|
-
createProject(params: {
|
|
1651
|
-
name: string;
|
|
1652
|
-
description?: string;
|
|
1653
|
-
settings?: Record<string, any>;
|
|
1654
|
-
}): Promise<Project>;
|
|
1655
|
-
listProjects(): Promise<{
|
|
1656
|
-
projects: Project[];
|
|
1657
|
-
}>;
|
|
1658
|
-
getProject(id: string): Promise<Project & {
|
|
1659
|
-
sources: Source[];
|
|
1660
|
-
}>;
|
|
1661
|
-
listSources(project?: string): Promise<{
|
|
1662
|
-
project: {
|
|
1663
|
-
id: string;
|
|
1664
|
-
name: string;
|
|
1665
|
-
slug: string;
|
|
1666
|
-
};
|
|
1667
|
-
sources: Source[];
|
|
1668
|
-
}>;
|
|
1669
|
-
deleteProject(id: string): Promise<{
|
|
1670
|
-
deleted: boolean;
|
|
1671
|
-
}>;
|
|
1672
|
-
addSource(projectId: string, params: {
|
|
1673
|
-
name: string;
|
|
1674
|
-
connector_type: string;
|
|
1675
|
-
config: Record<string, any>;
|
|
1676
|
-
sync_schedule?: string;
|
|
1677
|
-
}): Promise<Source>;
|
|
1678
|
-
syncSource(sourceId: string): Promise<any>;
|
|
1679
|
-
addSourceByType(projectId: string, params: {
|
|
1680
|
-
type: "video";
|
|
1681
|
-
url: string;
|
|
1682
|
-
auto_sync?: boolean;
|
|
1683
|
-
tags?: string[];
|
|
1684
|
-
platform?: "youtube" | "loom" | "generic";
|
|
1685
|
-
language?: string;
|
|
1686
|
-
allow_stt_fallback?: boolean;
|
|
1687
|
-
max_duration_minutes?: number;
|
|
1688
|
-
name?: string;
|
|
1689
|
-
ingestion_profile?: "auto" | "repo" | "web_docs" | "pdf_layout" | "video_transcript" | "plain_text";
|
|
1690
|
-
strategy_override?: "fixed" | "recursive" | "semantic" | "hierarchical" | "adaptive";
|
|
1691
|
-
profile_config?: Record<string, any>;
|
|
1692
|
-
}): Promise<{
|
|
1693
|
-
source_id: string;
|
|
1694
|
-
sync_job_id?: string | null;
|
|
1695
|
-
status: "processing" | "queued" | "created";
|
|
1696
|
-
}>;
|
|
1697
|
-
getSourceStatus(sourceId: string): Promise<VideoIngestionStatus>;
|
|
1698
|
-
createCanonicalSource(project: string, params: CanonicalSourceCreateParams): Promise<CanonicalSourceCreateResult>;
|
|
1699
|
-
ingest(projectId: string, documents: Array<{
|
|
1700
|
-
id?: string;
|
|
1701
|
-
title: string;
|
|
1702
|
-
content: string;
|
|
1703
|
-
metadata?: Record<string, any>;
|
|
1704
|
-
file_path?: string;
|
|
1705
|
-
ingestion_profile?: "auto" | "repo" | "web_docs" | "pdf_layout" | "video_transcript" | "plain_text";
|
|
1706
|
-
strategy_override?: "fixed" | "recursive" | "semantic" | "hierarchical" | "adaptive";
|
|
1707
|
-
profile_config?: Record<string, any>;
|
|
1708
|
-
}>): Promise<{
|
|
1709
|
-
ingested: number;
|
|
1710
|
-
}>;
|
|
1711
|
-
addContext(params: {
|
|
1712
|
-
project?: string;
|
|
1713
|
-
content: string;
|
|
1714
|
-
title?: string;
|
|
1715
|
-
metadata?: Record<string, any>;
|
|
1716
|
-
}): Promise<{
|
|
1717
|
-
ingested: number;
|
|
1718
|
-
}>;
|
|
1719
|
-
learn(params: LearnInput): Promise<LearnResult>;
|
|
1720
|
-
listMemories(params: {
|
|
1721
|
-
project?: string;
|
|
1722
|
-
user_id?: string;
|
|
1723
|
-
session_id?: string;
|
|
1724
|
-
agent_id?: string;
|
|
1725
|
-
limit?: number;
|
|
1726
|
-
}): Promise<{
|
|
1727
|
-
memories: any[];
|
|
1728
|
-
}>;
|
|
1729
|
-
addMemory(params: {
|
|
1730
|
-
project?: string;
|
|
1731
|
-
content: string;
|
|
1732
|
-
memory_type?: "factual" | "episodic" | "semantic" | "procedural" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
1733
|
-
user_id?: string;
|
|
1734
|
-
session_id?: string;
|
|
1735
|
-
agent_id?: string;
|
|
1736
|
-
importance?: number;
|
|
1737
|
-
metadata?: Record<string, any>;
|
|
1738
|
-
expires_in_seconds?: number;
|
|
1739
|
-
async?: boolean;
|
|
1740
|
-
write_mode?: "async" | "sync";
|
|
1741
|
-
allow_legacy_fallback?: boolean;
|
|
1742
|
-
}): Promise<MemoryWriteResult>;
|
|
1743
|
-
addMemoriesBulk(params: {
|
|
1744
|
-
project?: string;
|
|
1745
|
-
memories: Array<{
|
|
1746
|
-
content: string;
|
|
1747
|
-
memory_type?: MemoryKind | "episodic" | "semantic" | "procedural";
|
|
1748
|
-
user_id?: string;
|
|
1749
|
-
session_id?: string;
|
|
1750
|
-
agent_id?: string;
|
|
1751
|
-
importance?: number;
|
|
1752
|
-
confidence?: number;
|
|
1753
|
-
metadata?: Record<string, any>;
|
|
1754
|
-
entity_mentions?: string[];
|
|
1755
|
-
document_date?: string;
|
|
1756
|
-
event_date?: string;
|
|
1757
|
-
}>;
|
|
1758
|
-
namespace?: string;
|
|
1759
|
-
tags?: string[];
|
|
1760
|
-
async?: boolean;
|
|
1761
|
-
write_mode?: "async" | "sync";
|
|
1762
|
-
webhook_url?: string;
|
|
1763
|
-
}): Promise<any>;
|
|
1764
|
-
extractMemories(params: {
|
|
1765
|
-
project?: string;
|
|
1766
|
-
message: string;
|
|
1767
|
-
context?: string;
|
|
1768
|
-
session_id?: string;
|
|
1769
|
-
user_id?: string;
|
|
1770
|
-
enable_pattern?: boolean;
|
|
1771
|
-
enable_inference?: boolean;
|
|
1772
|
-
min_confidence?: number;
|
|
1773
|
-
}): Promise<MemoryExtractionResult>;
|
|
1774
|
-
extractSessionMemories(params: {
|
|
1775
|
-
project?: string;
|
|
1776
|
-
user_id?: string;
|
|
1777
|
-
messages: Array<{
|
|
1778
|
-
role: "user" | "assistant" | "system";
|
|
1779
|
-
content: string;
|
|
1780
|
-
timestamp?: string;
|
|
1781
|
-
}>;
|
|
1782
|
-
enable_pattern?: boolean;
|
|
1783
|
-
enable_inference?: boolean;
|
|
1784
|
-
}): Promise<{
|
|
1785
|
-
memories: ExtractedMemory[];
|
|
1786
|
-
count: number;
|
|
1787
|
-
latencyMs: number;
|
|
1788
|
-
}>;
|
|
1789
|
-
searchMemories(params: {
|
|
1790
|
-
project?: string;
|
|
1791
|
-
query: string;
|
|
1792
|
-
user_id?: string;
|
|
1793
|
-
session_id?: string;
|
|
1794
|
-
agent_id?: string;
|
|
1795
|
-
memory_type?: "factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
1796
|
-
top_k?: number;
|
|
1797
|
-
profile?: "fast" | "balanced" | "quality";
|
|
1798
|
-
include_pending?: boolean;
|
|
1799
|
-
}): Promise<MemorySearchResponse>;
|
|
1800
|
-
createApiKey(params: {
|
|
1801
|
-
name: string;
|
|
1802
|
-
scopes?: string[];
|
|
1803
|
-
rate_limit?: number;
|
|
1804
|
-
expires_in_days?: number;
|
|
1805
|
-
}): Promise<{
|
|
1806
|
-
key: string;
|
|
1807
|
-
prefix: string;
|
|
1808
|
-
name: string;
|
|
1809
|
-
}>;
|
|
1810
|
-
listApiKeys(): Promise<{
|
|
1811
|
-
keys: any[];
|
|
1812
|
-
}>;
|
|
1813
|
-
getUsage(days?: number): Promise<any>;
|
|
1814
|
-
searchMemoriesSOTA(params: {
|
|
1815
|
-
query: string;
|
|
1816
|
-
project?: string;
|
|
1817
|
-
user_id?: string;
|
|
1818
|
-
session_id?: string;
|
|
1819
|
-
question_date?: string;
|
|
1820
|
-
top_k?: number;
|
|
1821
|
-
memory_types?: Array<"factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction">;
|
|
1822
|
-
include_inactive?: boolean;
|
|
1823
|
-
include_chunks?: boolean;
|
|
1824
|
-
include_relations?: boolean;
|
|
1825
|
-
fast_mode?: boolean;
|
|
1826
|
-
profile?: "fast" | "balanced" | "quality";
|
|
1827
|
-
include_pending?: boolean;
|
|
1828
|
-
}): Promise<MemorySearchResponse>;
|
|
1829
|
-
ingestSession(params: {
|
|
1830
|
-
project?: string;
|
|
1831
|
-
session_id: string;
|
|
1832
|
-
user_id?: string;
|
|
1833
|
-
messages: Array<{
|
|
1834
|
-
role: string;
|
|
1835
|
-
content: string;
|
|
1836
|
-
timestamp: string;
|
|
1837
|
-
}>;
|
|
1838
|
-
async?: boolean;
|
|
1839
|
-
write_mode?: "async" | "sync";
|
|
1840
|
-
}): Promise<{
|
|
1841
|
-
success: boolean;
|
|
1842
|
-
memories_created: number;
|
|
1843
|
-
relations_created: number;
|
|
1844
|
-
memories_invalidated: number;
|
|
1845
|
-
errors?: string[];
|
|
1846
|
-
} & MemoryWriteAck>;
|
|
1847
|
-
getSessionMemories(params: {
|
|
1848
|
-
session_id: string;
|
|
1849
|
-
project?: string;
|
|
1850
|
-
limit?: number;
|
|
1851
|
-
since_date?: string;
|
|
1852
|
-
include_pending?: boolean;
|
|
1853
|
-
}): Promise<{
|
|
1854
|
-
memories: any[];
|
|
1855
|
-
count: number;
|
|
1856
|
-
}>;
|
|
1857
|
-
getUserProfile(params: {
|
|
1858
|
-
user_id: string;
|
|
1859
|
-
project?: string;
|
|
1860
|
-
memory_types?: string;
|
|
1861
|
-
include_pending?: boolean;
|
|
1862
|
-
}): Promise<{
|
|
1863
|
-
user_id: string;
|
|
1864
|
-
memories: any[];
|
|
1865
|
-
count: number;
|
|
1866
|
-
}>;
|
|
1867
|
-
getMemory(memoryId: string): Promise<{
|
|
1868
|
-
memory: any;
|
|
1869
|
-
}>;
|
|
1870
|
-
getMemoryVersions(memoryId: string): Promise<{
|
|
1871
|
-
memory_id: string;
|
|
1872
|
-
versions: any[];
|
|
1873
|
-
count: number;
|
|
1874
|
-
}>;
|
|
1875
|
-
updateMemory(memoryId: string, params: {
|
|
1876
|
-
content: string;
|
|
1877
|
-
reasoning?: string;
|
|
1878
|
-
}): Promise<{
|
|
1879
|
-
success: boolean;
|
|
1880
|
-
new_memory_id: string;
|
|
1881
|
-
old_memory_id: string;
|
|
1882
|
-
}>;
|
|
1883
|
-
deleteMemory(memoryId: string): Promise<{
|
|
1884
|
-
success: boolean;
|
|
1885
|
-
deleted: string;
|
|
1886
|
-
}>;
|
|
1887
|
-
getMemoryRelations(memoryId: string): Promise<{
|
|
1888
|
-
memory_id: string;
|
|
1889
|
-
relations: any[];
|
|
1890
|
-
count: number;
|
|
1891
|
-
}>;
|
|
1892
|
-
getMemoryGraph(params: {
|
|
1893
|
-
project?: string;
|
|
1894
|
-
user_id?: string;
|
|
1895
|
-
session_id?: string;
|
|
1896
|
-
include_inactive?: boolean;
|
|
1897
|
-
limit?: number;
|
|
1898
|
-
}): Promise<any>;
|
|
1899
|
-
getConversationGraph(params: {
|
|
1900
|
-
project?: string;
|
|
1901
|
-
session_id: string;
|
|
1902
|
-
include_inactive?: boolean;
|
|
1903
|
-
limit?: number;
|
|
1904
|
-
}): Promise<any>;
|
|
1905
|
-
oracleSearch(params: {
|
|
1906
|
-
query: string;
|
|
1907
|
-
project?: string;
|
|
1908
|
-
max_results?: number;
|
|
1909
|
-
mode?: "search" | "research";
|
|
1910
|
-
max_steps?: number;
|
|
1911
|
-
}): Promise<any>;
|
|
1912
|
-
autosubscribe(params: {
|
|
1913
|
-
project?: string;
|
|
1914
|
-
source: {
|
|
1915
|
-
type: "github" | "local";
|
|
1916
|
-
owner?: string;
|
|
1917
|
-
repo?: string;
|
|
1918
|
-
path?: string;
|
|
1919
|
-
};
|
|
1920
|
-
dependency_file?: "package.json" | "requirements.txt" | "Cargo.toml" | "go.mod" | "Gemfile";
|
|
1921
|
-
index_limit?: number;
|
|
1922
|
-
auto_sync?: boolean;
|
|
1923
|
-
}): Promise<{
|
|
1924
|
-
success: boolean;
|
|
1925
|
-
discovered: number;
|
|
1926
|
-
indexed: number;
|
|
1927
|
-
errors: string[];
|
|
1928
|
-
dependencies?: any[];
|
|
1929
|
-
auto_sync_enabled: boolean;
|
|
1930
|
-
}>;
|
|
1931
|
-
createSharedContext(params: {
|
|
1932
|
-
session_id: string;
|
|
1933
|
-
project?: string;
|
|
1934
|
-
title?: string;
|
|
1935
|
-
include_memories?: boolean;
|
|
1936
|
-
include_chunks?: boolean;
|
|
1937
|
-
expiry_days?: number;
|
|
1938
|
-
}): Promise<{
|
|
1939
|
-
success: boolean;
|
|
1940
|
-
share_id: string;
|
|
1941
|
-
share_url: string;
|
|
1942
|
-
title: string;
|
|
1943
|
-
memories_count: number;
|
|
1944
|
-
messages_count: number;
|
|
1945
|
-
expires_at: string;
|
|
1946
|
-
}>;
|
|
1947
|
-
loadSharedContext(shareId: string): Promise<{
|
|
1948
|
-
share_id: string;
|
|
1949
|
-
title: string;
|
|
1950
|
-
created_at: string;
|
|
1951
|
-
expires_at: string;
|
|
1952
|
-
memories: any[];
|
|
1953
|
-
messages: any[];
|
|
1954
|
-
chunks?: any[];
|
|
1955
|
-
metadata: any;
|
|
1956
|
-
}>;
|
|
1957
|
-
resumeFromSharedContext(params: {
|
|
1958
|
-
share_id: string;
|
|
1959
|
-
project?: string;
|
|
1960
|
-
new_session_id?: string;
|
|
1961
|
-
}): Promise<{
|
|
1962
|
-
success: boolean;
|
|
1963
|
-
session_id: string;
|
|
1964
|
-
memories_restored: number;
|
|
1965
|
-
messages_restored: number;
|
|
1966
|
-
chunks_restored: number;
|
|
1967
|
-
}>;
|
|
1968
|
-
consolidateMemories(params: {
|
|
1969
|
-
project?: string;
|
|
1970
|
-
similarity_threshold?: number;
|
|
1971
|
-
auto_merge?: boolean;
|
|
1972
|
-
dry_run?: boolean;
|
|
1973
|
-
}): Promise<any>;
|
|
1974
|
-
updateImportanceDecay(params: {
|
|
1975
|
-
project?: string;
|
|
1976
|
-
decay_function?: "exponential" | "linear" | "logarithmic";
|
|
1977
|
-
half_life_days?: number;
|
|
1978
|
-
access_boost?: number;
|
|
1979
|
-
auto_archive?: boolean;
|
|
1980
|
-
archive_threshold?: number;
|
|
1981
|
-
}): Promise<{
|
|
1982
|
-
success: boolean;
|
|
1983
|
-
memories_updated: number;
|
|
1984
|
-
average_importance: number;
|
|
1985
|
-
memories_archived: number;
|
|
1986
|
-
config: any;
|
|
1987
|
-
}>;
|
|
1988
|
-
getImportanceStats(project?: string): Promise<{
|
|
1989
|
-
project_id: string;
|
|
1990
|
-
statistics: any;
|
|
1991
|
-
}>;
|
|
1992
|
-
getCacheStats(): Promise<{
|
|
1993
|
-
cache_type: string;
|
|
1994
|
-
hit_rate: number;
|
|
1995
|
-
total_requests: number;
|
|
1996
|
-
hits: number;
|
|
1997
|
-
misses: number;
|
|
1998
|
-
size_bytes: number;
|
|
1999
|
-
keys_count: number;
|
|
2000
|
-
average_latency_ms: number;
|
|
2001
|
-
uptime_seconds: number;
|
|
2002
|
-
}>;
|
|
2003
|
-
warmCache(params: {
|
|
2004
|
-
project?: string;
|
|
2005
|
-
queries: string[];
|
|
2006
|
-
ttl_seconds?: number;
|
|
2007
|
-
}): Promise<{
|
|
2008
|
-
success: boolean;
|
|
2009
|
-
queries_warmed: number;
|
|
2010
|
-
errors: string[];
|
|
2011
|
-
cache_size_increase_bytes: number;
|
|
2012
|
-
}>;
|
|
2013
|
-
clearCache(params: {
|
|
2014
|
-
pattern?: string;
|
|
2015
|
-
clear_all?: boolean;
|
|
2016
|
-
}): Promise<{
|
|
2017
|
-
success: boolean;
|
|
2018
|
-
keys_cleared: number;
|
|
2019
|
-
bytes_freed: number;
|
|
2020
|
-
}>;
|
|
2021
|
-
getCostSummary(params?: {
|
|
2022
|
-
project?: string;
|
|
2023
|
-
start_date?: string;
|
|
2024
|
-
end_date?: string;
|
|
2025
|
-
}): Promise<any>;
|
|
2026
|
-
getCostBreakdown(params?: {
|
|
2027
|
-
project?: string;
|
|
2028
|
-
group_by?: "model" | "task" | "day" | "hour";
|
|
2029
|
-
start_date?: string;
|
|
2030
|
-
end_date?: string;
|
|
2031
|
-
}): Promise<any>;
|
|
2032
|
-
/**
|
|
2033
|
-
* Semantic search over raw documents without pre-indexing.
|
|
2034
|
-
* Send file contents/summaries directly — the API embeds them in-memory and ranks by similarity.
|
|
2035
|
-
* Perfect for AI agents to semantically explore a codebase on-the-fly.
|
|
2036
|
-
*/
|
|
2037
|
-
semanticSearch(params: {
|
|
2038
|
-
query: string;
|
|
2039
|
-
documents: Array<{
|
|
2040
|
-
id: string;
|
|
2041
|
-
content: string;
|
|
2042
|
-
}>;
|
|
2043
|
-
top_k?: number;
|
|
2044
|
-
threshold?: number;
|
|
2045
|
-
}): Promise<{
|
|
2046
|
-
results: Array<{
|
|
2047
|
-
id: string;
|
|
2048
|
-
score: number;
|
|
2049
|
-
content: string;
|
|
2050
|
-
snippet: string;
|
|
2051
|
-
}>;
|
|
2052
|
-
total_searched: number;
|
|
2053
|
-
total_returned: number;
|
|
2054
|
-
query: string;
|
|
2055
|
-
latency_ms: number;
|
|
2056
|
-
}>;
|
|
2057
|
-
searchFiles(params: {
|
|
2058
|
-
query: string;
|
|
2059
|
-
path?: string;
|
|
2060
|
-
mode?: "content" | "filename" | "both";
|
|
2061
|
-
file_types?: string[];
|
|
2062
|
-
max_results?: number;
|
|
2063
|
-
context_lines?: number;
|
|
2064
|
-
case_sensitive?: boolean;
|
|
2065
|
-
}): Promise<{
|
|
2066
|
-
results: Array<{
|
|
2067
|
-
file: string;
|
|
2068
|
-
matches: Array<{
|
|
2069
|
-
line: number;
|
|
2070
|
-
content: string;
|
|
2071
|
-
context_before: string[];
|
|
2072
|
-
context_after: string[];
|
|
2073
|
-
}>;
|
|
2074
|
-
}>;
|
|
2075
|
-
total_files: number;
|
|
2076
|
-
total_matches: number;
|
|
2077
|
-
search_path: string;
|
|
2078
|
-
mode: string;
|
|
2079
|
-
latency_ms: number;
|
|
2080
|
-
engine: "ripgrep" | "node";
|
|
2081
|
-
}>;
|
|
2082
|
-
getCostSavings(params?: {
|
|
2083
|
-
project?: string;
|
|
2084
|
-
start_date?: string;
|
|
2085
|
-
end_date?: string;
|
|
2086
|
-
}): Promise<any>;
|
|
2087
|
-
readonly projects: {
|
|
2088
|
-
create: (params: {
|
|
2089
|
-
name: string;
|
|
2090
|
-
description?: string;
|
|
2091
|
-
settings?: Record<string, any>;
|
|
2092
|
-
}) => Promise<Project>;
|
|
2093
|
-
list: () => Promise<{
|
|
2094
|
-
projects: Project[];
|
|
2095
|
-
}>;
|
|
2096
|
-
get: (id: string) => Promise<Project & {
|
|
2097
|
-
sources: Source[];
|
|
2098
|
-
}>;
|
|
2099
|
-
delete: (id: string) => Promise<{
|
|
2100
|
-
deleted: boolean;
|
|
2101
|
-
}>;
|
|
2102
|
-
};
|
|
2103
|
-
readonly sources: {
|
|
2104
|
-
add: (projectId: string, params: {
|
|
2105
|
-
name: string;
|
|
2106
|
-
connector_type: string;
|
|
2107
|
-
config: Record<string, any>;
|
|
2108
|
-
sync_schedule?: string;
|
|
2109
|
-
}) => Promise<Source>;
|
|
2110
|
-
addSource: (projectId: string, params: {
|
|
2111
|
-
type: "video";
|
|
2112
|
-
url: string;
|
|
2113
|
-
auto_sync?: boolean;
|
|
2114
|
-
tags?: string[];
|
|
2115
|
-
platform?: "youtube" | "loom" | "generic";
|
|
2116
|
-
language?: string;
|
|
2117
|
-
allow_stt_fallback?: boolean;
|
|
2118
|
-
max_duration_minutes?: number;
|
|
2119
|
-
name?: string;
|
|
2120
|
-
}) => Promise<{
|
|
2121
|
-
source_id: string;
|
|
2122
|
-
sync_job_id?: string | null;
|
|
2123
|
-
status: "processing" | "queued" | "created";
|
|
2124
|
-
}>;
|
|
2125
|
-
sync: (sourceId: string) => Promise<any>;
|
|
2126
|
-
syncSource: (sourceId: string) => Promise<any>;
|
|
2127
|
-
status: (sourceId: string) => Promise<VideoIngestionStatus>;
|
|
2128
|
-
getStatus: (sourceId: string) => Promise<VideoIngestionStatus>;
|
|
2129
|
-
};
|
|
2130
|
-
readonly memory: {
|
|
2131
|
-
add: (params: Parameters<WhisperContext["addMemory"]>[0]) => Promise<MemoryWriteResult>;
|
|
2132
|
-
addBulk: (params: Parameters<WhisperContext["addMemoriesBulk"]>[0]) => Promise<any>;
|
|
2133
|
-
extract: (params: Parameters<WhisperContext["extractMemories"]>[0]) => Promise<MemoryExtractionResult>;
|
|
2134
|
-
extractSession: (params: Parameters<WhisperContext["extractSessionMemories"]>[0]) => Promise<{
|
|
2135
|
-
memories: ExtractedMemory[];
|
|
2136
|
-
count: number;
|
|
2137
|
-
latencyMs: number;
|
|
2138
|
-
}>;
|
|
2139
|
-
search: (params: Parameters<WhisperContext["searchMemories"]>[0]) => Promise<MemorySearchResponse>;
|
|
2140
|
-
searchSOTA: (params: Parameters<WhisperContext["searchMemoriesSOTA"]>[0]) => Promise<MemorySearchResponse>;
|
|
2141
|
-
ingestSession: (params: Parameters<WhisperContext["ingestSession"]>[0]) => Promise<{
|
|
2142
|
-
success: boolean;
|
|
2143
|
-
memories_created: number;
|
|
2144
|
-
relations_created: number;
|
|
2145
|
-
memories_invalidated: number;
|
|
2146
|
-
errors?: string[];
|
|
2147
|
-
} & MemoryWriteAck>;
|
|
2148
|
-
getSessionMemories: (params: Parameters<WhisperContext["getSessionMemories"]>[0]) => Promise<{
|
|
2149
|
-
memories: any[];
|
|
2150
|
-
count: number;
|
|
2151
|
-
}>;
|
|
2152
|
-
getUserProfile: (params: Parameters<WhisperContext["getUserProfile"]>[0]) => Promise<{
|
|
2153
|
-
user_id: string;
|
|
2154
|
-
memories: any[];
|
|
2155
|
-
count: number;
|
|
2156
|
-
}>;
|
|
2157
|
-
get: (memoryId: string) => Promise<{
|
|
2158
|
-
memory: any;
|
|
2159
|
-
}>;
|
|
2160
|
-
getVersions: (memoryId: string) => Promise<{
|
|
2161
|
-
memory_id: string;
|
|
2162
|
-
versions: any[];
|
|
2163
|
-
count: number;
|
|
2164
|
-
}>;
|
|
2165
|
-
update: (memoryId: string, params: Parameters<WhisperContext["updateMemory"]>[1]) => Promise<{
|
|
2166
|
-
success: boolean;
|
|
2167
|
-
new_memory_id: string;
|
|
2168
|
-
old_memory_id: string;
|
|
2169
|
-
}>;
|
|
2170
|
-
delete: (memoryId: string) => Promise<{
|
|
2171
|
-
success: boolean;
|
|
2172
|
-
deleted: string;
|
|
2173
|
-
}>;
|
|
2174
|
-
getRelations: (memoryId: string) => Promise<{
|
|
2175
|
-
memory_id: string;
|
|
2176
|
-
relations: any[];
|
|
2177
|
-
count: number;
|
|
2178
|
-
}>;
|
|
2179
|
-
getGraph: (params: Parameters<WhisperContext["getMemoryGraph"]>[0]) => Promise<any>;
|
|
2180
|
-
getConversationGraph: (params: Parameters<WhisperContext["getConversationGraph"]>[0]) => Promise<any>;
|
|
2181
|
-
consolidate: (params: Parameters<WhisperContext["consolidateMemories"]>[0]) => Promise<any>;
|
|
2182
|
-
updateDecay: (params: Parameters<WhisperContext["updateImportanceDecay"]>[0]) => Promise<{
|
|
2183
|
-
success: boolean;
|
|
2184
|
-
memories_updated: number;
|
|
2185
|
-
average_importance: number;
|
|
2186
|
-
memories_archived: number;
|
|
2187
|
-
config: any;
|
|
2188
|
-
}>;
|
|
2189
|
-
getImportanceStats: (project?: string) => Promise<{
|
|
2190
|
-
project_id: string;
|
|
2191
|
-
statistics: any;
|
|
2192
|
-
}>;
|
|
2193
|
-
};
|
|
2194
|
-
readonly keys: {
|
|
2195
|
-
create: (params: Parameters<WhisperContext["createApiKey"]>[0]) => Promise<{
|
|
2196
|
-
key: string;
|
|
2197
|
-
prefix: string;
|
|
2198
|
-
name: string;
|
|
2199
|
-
}>;
|
|
2200
|
-
list: () => Promise<{
|
|
2201
|
-
keys: any[];
|
|
2202
|
-
}>;
|
|
2203
|
-
getUsage: (days?: number) => Promise<any>;
|
|
2204
|
-
};
|
|
2205
|
-
readonly oracle: {
|
|
2206
|
-
search: (params: Parameters<WhisperContext["oracleSearch"]>[0]) => Promise<any>;
|
|
2207
|
-
};
|
|
2208
|
-
readonly context: {
|
|
2209
|
-
createShare: (params: Parameters<WhisperContext["createSharedContext"]>[0]) => Promise<{
|
|
2210
|
-
success: boolean;
|
|
2211
|
-
share_id: string;
|
|
2212
|
-
share_url: string;
|
|
2213
|
-
title: string;
|
|
2214
|
-
memories_count: number;
|
|
2215
|
-
messages_count: number;
|
|
2216
|
-
expires_at: string;
|
|
2217
|
-
}>;
|
|
2218
|
-
loadShare: (shareId: string) => Promise<{
|
|
2219
|
-
share_id: string;
|
|
2220
|
-
title: string;
|
|
2221
|
-
created_at: string;
|
|
2222
|
-
expires_at: string;
|
|
2223
|
-
memories: any[];
|
|
2224
|
-
messages: any[];
|
|
2225
|
-
chunks?: any[];
|
|
2226
|
-
metadata: any;
|
|
2227
|
-
}>;
|
|
2228
|
-
resumeShare: (params: Parameters<WhisperContext["resumeFromSharedContext"]>[0]) => Promise<{
|
|
2229
|
-
success: boolean;
|
|
2230
|
-
session_id: string;
|
|
2231
|
-
memories_restored: number;
|
|
2232
|
-
messages_restored: number;
|
|
2233
|
-
chunks_restored: number;
|
|
2234
|
-
}>;
|
|
2235
|
-
};
|
|
2236
|
-
readonly optimization: {
|
|
2237
|
-
getCacheStats: () => Promise<{
|
|
2238
|
-
cache_type: string;
|
|
2239
|
-
hit_rate: number;
|
|
2240
|
-
total_requests: number;
|
|
2241
|
-
hits: number;
|
|
2242
|
-
misses: number;
|
|
2243
|
-
size_bytes: number;
|
|
2244
|
-
keys_count: number;
|
|
2245
|
-
average_latency_ms: number;
|
|
2246
|
-
uptime_seconds: number;
|
|
2247
|
-
}>;
|
|
2248
|
-
warmCache: (params: Parameters<WhisperContext["warmCache"]>[0]) => Promise<{
|
|
2249
|
-
success: boolean;
|
|
2250
|
-
queries_warmed: number;
|
|
2251
|
-
errors: string[];
|
|
2252
|
-
cache_size_increase_bytes: number;
|
|
2253
|
-
}>;
|
|
2254
|
-
clearCache: (params: Parameters<WhisperContext["clearCache"]>[0]) => Promise<{
|
|
2255
|
-
success: boolean;
|
|
2256
|
-
keys_cleared: number;
|
|
2257
|
-
bytes_freed: number;
|
|
2258
|
-
}>;
|
|
2259
|
-
getCostSummary: (params?: Parameters<WhisperContext["getCostSummary"]>[0]) => Promise<any>;
|
|
2260
|
-
getCostBreakdown: (params?: Parameters<WhisperContext["getCostBreakdown"]>[0]) => Promise<any>;
|
|
2261
|
-
getCostSavings: (params?: Parameters<WhisperContext["getCostSavings"]>[0]) => Promise<any>;
|
|
2262
|
-
};
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
export { type AgentRunContext, type AgentRuntimeOptions, type AgentRuntimeRankWeights, type AgentRuntimeRetrievalOptions, type AgentRuntimeSourceActivityOptions, type AgentRuntimeStatus, type CanonicalSourceCreateParams, type CanonicalSourceCreateResult, type CanonicalSourceType, type ExtractedMemory, LangChainMemoryAdapter, LangGraphCheckpointAdapter, type LearnConversationInput, type LearnConversationResult, type LearnInput, type LearnResult, type LearnSourceInput, type LearnSourceResult, type LearnSourceType, type LearnTextInput, type LearnTextResult, type Memory, type MemoryExtractionResult, type MemoryKind, type MemoryLatencyBreakdown, type MemorySearchResponse, type MemoryWriteAck, type MemoryWriteResult, type PreparedTurn, type Project, type QueryParams, type QueryResult, type Source, type TurnCaptureResult, type TurnInput, type VideoIngestionStatus, type VideoSourceMetadata, Whisper, WhisperAgentMiddleware, WhisperClient, type WhisperConfig, WhisperContext, Whisper as WhisperDefault, WhisperError, type WhisperErrorCode, WhisperClient as WhisperRuntimeClient, type WorkEvent, type WorkEventKind, type WorkEventSalience, createAgentMiddleware, createLangChainMemoryAdapter, createLangGraphCheckpointAdapter, WhisperContext as default, memoryGraphToMermaid };
|
|
1
|
+
export { A as AgentRunContext, g as AgentRuntimeOptions, h as AgentRuntimeRankWeights, i as AgentRuntimeRetrievalOptions, j as AgentRuntimeSourceActivityOptions, k as AgentRuntimeStatus, C as CanonicalSourceCreateParams, l as CanonicalSourceCreateResult, m as CanonicalSourceType, E as ExtractedMemory, L as LangChainMemoryAdapter, n as LangGraphCheckpointAdapter, o as LearnConversationInput, p as LearnConversationResult, q as LearnInput, r as LearnResult, s as LearnSourceInput, t as LearnSourceResult, u as LearnSourceType, v as LearnTextInput, x as LearnTextResult, y as Memory, z as MemoryExtractionResult, B as MemoryKind, D as MemoryLatencyBreakdown, M as MemoryRouterConfig, b as MemoryRouterFallbackReason, c as MemoryRouterResult, d as MemoryRouterTrace, F as MemorySearchResponse, G as MemoryWriteAck, H as MemoryWriteResult, P as PreparedTurn, I as Project, Q as QueryParams, J as QueryResult, R as RunContext, S as Source, T as TurnCaptureResult, K as TurnInput, V as VideoIngestionStatus, N as VideoSourceMetadata, O as Whisper, U as WhisperAgentMiddleware, X as WhisperClient, Y as WhisperClientConfig, Z as WhisperConfig, _ as WhisperContext, O as WhisperDefault, $ as WhisperEnvironment, a0 as WhisperError, a1 as WhisperErrorCode, a2 as WhisperIdentityMode, e as WhisperMemoryRouter, a3 as WhisperPreflightCheck, a4 as WhisperPreflightResult, a5 as WhisperResolvedIdentity, X as WhisperRuntimeClient, W as WhisperToolDefinition, a as WhisperToolsOptions, WithWhisperOptions, a6 as WorkEvent, a7 as WorkEventKind, a8 as WorkEventSalience, a9 as createAgentMiddleware, aa as createLangChainMemoryAdapter, ab as createLangGraphCheckpointAdapter, f as createMemoryRouter, _ as default, ac as memoryGraphToMermaid, w as whisperTools, withWhisper } from './adapters/ai-sdk.js';
|
|
2
|
+
import 'zod';
|