@usewhisper/sdk 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +193 -0
- package/index.d.cts +266 -0
- package/index.d.ts +299 -8
- package/index.js +277 -9
- package/package.json +8 -4
package/index.cjs
CHANGED
|
@@ -109,6 +109,199 @@ var WhisperContext = class {
|
|
|
109
109
|
async getUsage(days = 30) {
|
|
110
110
|
return this.request(`/v1/usage?days=${days}`);
|
|
111
111
|
}
|
|
112
|
+
// ─── SOTA Memory System ─────────────────────────────────────────
|
|
113
|
+
/**
|
|
114
|
+
* SOTA Memory Search - Search memories with temporal and type filtering
|
|
115
|
+
*/
|
|
116
|
+
async searchMemoriesSOTA(params) {
|
|
117
|
+
return this.request("/v1/memory/search", {
|
|
118
|
+
method: "POST",
|
|
119
|
+
body: JSON.stringify(params)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Ingest Session - Create memories from a conversation
|
|
124
|
+
*/
|
|
125
|
+
async ingestSession(params) {
|
|
126
|
+
return this.request("/v1/memory/ingest/session", {
|
|
127
|
+
method: "POST",
|
|
128
|
+
body: JSON.stringify(params)
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get Session Memories - Recent memories from a session
|
|
133
|
+
*/
|
|
134
|
+
async getSessionMemories(params) {
|
|
135
|
+
const query = new URLSearchParams({
|
|
136
|
+
project: params.project,
|
|
137
|
+
...params.limit && { limit: params.limit.toString() },
|
|
138
|
+
...params.since_date && { since_date: params.since_date }
|
|
139
|
+
});
|
|
140
|
+
return this.request(`/v1/memory/session/${params.session_id}?${query}`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get User Profile - Long-term user preferences and facts
|
|
144
|
+
*/
|
|
145
|
+
async getUserProfile(params) {
|
|
146
|
+
const query = new URLSearchParams({
|
|
147
|
+
project: params.project,
|
|
148
|
+
...params.memory_types && { memory_types: params.memory_types }
|
|
149
|
+
});
|
|
150
|
+
return this.request(`/v1/memory/profile/${params.user_id}?${query}`);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get Memory Versions - Version chain history
|
|
154
|
+
*/
|
|
155
|
+
async getMemoryVersions(memoryId) {
|
|
156
|
+
return this.request(`/v1/memory/${memoryId}/versions`);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Update Memory - Create a new version
|
|
160
|
+
*/
|
|
161
|
+
async updateMemory(memoryId, params) {
|
|
162
|
+
return this.request(`/v1/memory/${memoryId}`, {
|
|
163
|
+
method: "PUT",
|
|
164
|
+
body: JSON.stringify(params)
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Delete Memory - Soft delete
|
|
169
|
+
*/
|
|
170
|
+
async deleteMemory(memoryId) {
|
|
171
|
+
return this.request(`/v1/memory/${memoryId}`, { method: "DELETE" });
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get Memory Relations - Graph connections
|
|
175
|
+
*/
|
|
176
|
+
async getMemoryRelations(memoryId) {
|
|
177
|
+
return this.request(`/v1/memory/${memoryId}/relations`);
|
|
178
|
+
}
|
|
179
|
+
// ─── Context Layer ──────────────────────────────────────────────
|
|
180
|
+
/**
|
|
181
|
+
* Oracle Search - Tree-guided document navigation with research mode
|
|
182
|
+
*/
|
|
183
|
+
async oracleSearch(params) {
|
|
184
|
+
return this.request("/v1/oracle/search", {
|
|
185
|
+
method: "POST",
|
|
186
|
+
body: JSON.stringify(params)
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Autosubscribe - Auto-index project dependencies
|
|
191
|
+
*/
|
|
192
|
+
async autosubscribe(params) {
|
|
193
|
+
return this.request("/v1/autosubscribe", {
|
|
194
|
+
method: "POST",
|
|
195
|
+
body: JSON.stringify(params)
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Create Shared Context - Save and share a conversation
|
|
200
|
+
*/
|
|
201
|
+
async createSharedContext(params) {
|
|
202
|
+
return this.request("/v1/context/share", {
|
|
203
|
+
method: "POST",
|
|
204
|
+
body: JSON.stringify(params)
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Load Shared Context - View shared context (public endpoint)
|
|
209
|
+
*/
|
|
210
|
+
async loadSharedContext(shareId) {
|
|
211
|
+
return this.request(`/v1/context/shared/${shareId}`);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Resume from Shared Context - Fork shared context to new session
|
|
215
|
+
*/
|
|
216
|
+
async resumeFromSharedContext(params) {
|
|
217
|
+
return this.request("/v1/context/resume", {
|
|
218
|
+
method: "POST",
|
|
219
|
+
body: JSON.stringify(params)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
// ─── Optimization ───────────────────────────────────────────────
|
|
223
|
+
/**
|
|
224
|
+
* Consolidate Memories - Find and merge duplicates
|
|
225
|
+
*/
|
|
226
|
+
async consolidateMemories(params) {
|
|
227
|
+
return this.request("/v1/memory/consolidate", {
|
|
228
|
+
method: "POST",
|
|
229
|
+
body: JSON.stringify(params)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Update Importance Decay - Apply time-based relevance scoring
|
|
234
|
+
*/
|
|
235
|
+
async updateImportanceDecay(params) {
|
|
236
|
+
return this.request("/v1/memory/decay/update", {
|
|
237
|
+
method: "POST",
|
|
238
|
+
body: JSON.stringify(params)
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get Importance Statistics
|
|
243
|
+
*/
|
|
244
|
+
async getImportanceStats(project) {
|
|
245
|
+
return this.request(`/v1/memory/decay/stats?project=${project}`);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get Cache Statistics
|
|
249
|
+
*/
|
|
250
|
+
async getCacheStats() {
|
|
251
|
+
return this.request("/v1/cache/stats");
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Warm Cache - Preload common queries
|
|
255
|
+
*/
|
|
256
|
+
async warmCache(params) {
|
|
257
|
+
return this.request("/v1/cache/warm", {
|
|
258
|
+
method: "POST",
|
|
259
|
+
body: JSON.stringify(params)
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Clear Cache Pattern
|
|
264
|
+
*/
|
|
265
|
+
async clearCache(params) {
|
|
266
|
+
return this.request("/v1/cache/clear", {
|
|
267
|
+
method: "DELETE",
|
|
268
|
+
body: JSON.stringify(params)
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Get Cost Summary - Cost tracking overview
|
|
273
|
+
*/
|
|
274
|
+
async getCostSummary(params) {
|
|
275
|
+
const query = new URLSearchParams({
|
|
276
|
+
...params.project && { project: params.project },
|
|
277
|
+
...params.start_date && { start_date: params.start_date },
|
|
278
|
+
...params.end_date && { end_date: params.end_date }
|
|
279
|
+
});
|
|
280
|
+
return this.request(`/v1/cost/summary?${query}`);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get Cost Breakdown - Detailed cost analysis
|
|
284
|
+
*/
|
|
285
|
+
async getCostBreakdown(params) {
|
|
286
|
+
const query = new URLSearchParams({
|
|
287
|
+
...params.project && { project: params.project },
|
|
288
|
+
...params.group_by && { group_by: params.group_by },
|
|
289
|
+
...params.start_date && { start_date: params.start_date },
|
|
290
|
+
...params.end_date && { end_date: params.end_date }
|
|
291
|
+
});
|
|
292
|
+
return this.request(`/v1/cost/breakdown?${query}`);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get Savings Report - Compare actual vs always-Opus costs
|
|
296
|
+
*/
|
|
297
|
+
async getCostSavings(params) {
|
|
298
|
+
const query = new URLSearchParams({
|
|
299
|
+
...params.project && { project: params.project },
|
|
300
|
+
...params.start_date && { start_date: params.start_date },
|
|
301
|
+
...params.end_date && { end_date: params.end_date }
|
|
302
|
+
});
|
|
303
|
+
return this.request(`/v1/cost/savings?${query}`);
|
|
304
|
+
}
|
|
112
305
|
};
|
|
113
306
|
var index_default = WhisperContext;
|
|
114
307
|
// Annotate the CommonJS export names for ESM import in node:
|
package/index.d.cts
CHANGED
|
@@ -161,6 +161,272 @@ declare class WhisperContext {
|
|
|
161
161
|
keys: any[];
|
|
162
162
|
}>;
|
|
163
163
|
getUsage(days?: number): Promise<any>;
|
|
164
|
+
/**
|
|
165
|
+
* SOTA Memory Search - Search memories with temporal and type filtering
|
|
166
|
+
*/
|
|
167
|
+
searchMemoriesSOTA(params: {
|
|
168
|
+
query: string;
|
|
169
|
+
project: string;
|
|
170
|
+
user_id?: string;
|
|
171
|
+
session_id?: string;
|
|
172
|
+
question_date?: string;
|
|
173
|
+
top_k?: number;
|
|
174
|
+
memory_types?: Array<"factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction">;
|
|
175
|
+
include_inactive?: boolean;
|
|
176
|
+
include_chunks?: boolean;
|
|
177
|
+
include_relations?: boolean;
|
|
178
|
+
}): Promise<any>;
|
|
179
|
+
/**
|
|
180
|
+
* Ingest Session - Create memories from a conversation
|
|
181
|
+
*/
|
|
182
|
+
ingestSession(params: {
|
|
183
|
+
project: string;
|
|
184
|
+
session_id: string;
|
|
185
|
+
user_id?: string;
|
|
186
|
+
messages: Array<{
|
|
187
|
+
role: string;
|
|
188
|
+
content: string;
|
|
189
|
+
timestamp: string;
|
|
190
|
+
}>;
|
|
191
|
+
}): Promise<{
|
|
192
|
+
success: boolean;
|
|
193
|
+
memories_created: number;
|
|
194
|
+
relations_created: number;
|
|
195
|
+
memories_invalidated: number;
|
|
196
|
+
errors?: string[];
|
|
197
|
+
}>;
|
|
198
|
+
/**
|
|
199
|
+
* Get Session Memories - Recent memories from a session
|
|
200
|
+
*/
|
|
201
|
+
getSessionMemories(params: {
|
|
202
|
+
session_id: string;
|
|
203
|
+
project: string;
|
|
204
|
+
limit?: number;
|
|
205
|
+
since_date?: string;
|
|
206
|
+
}): Promise<{
|
|
207
|
+
memories: any[];
|
|
208
|
+
count: number;
|
|
209
|
+
}>;
|
|
210
|
+
/**
|
|
211
|
+
* Get User Profile - Long-term user preferences and facts
|
|
212
|
+
*/
|
|
213
|
+
getUserProfile(params: {
|
|
214
|
+
user_id: string;
|
|
215
|
+
project: string;
|
|
216
|
+
memory_types?: string;
|
|
217
|
+
}): Promise<{
|
|
218
|
+
user_id: string;
|
|
219
|
+
memories: any[];
|
|
220
|
+
count: number;
|
|
221
|
+
}>;
|
|
222
|
+
/**
|
|
223
|
+
* Get Memory Versions - Version chain history
|
|
224
|
+
*/
|
|
225
|
+
getMemoryVersions(memoryId: string): Promise<{
|
|
226
|
+
memory_id: string;
|
|
227
|
+
versions: any[];
|
|
228
|
+
count: number;
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* Update Memory - Create a new version
|
|
232
|
+
*/
|
|
233
|
+
updateMemory(memoryId: string, params: {
|
|
234
|
+
content: string;
|
|
235
|
+
reasoning?: string;
|
|
236
|
+
}): Promise<{
|
|
237
|
+
success: boolean;
|
|
238
|
+
new_memory_id: string;
|
|
239
|
+
old_memory_id: string;
|
|
240
|
+
}>;
|
|
241
|
+
/**
|
|
242
|
+
* Delete Memory - Soft delete
|
|
243
|
+
*/
|
|
244
|
+
deleteMemory(memoryId: string): Promise<{
|
|
245
|
+
success: boolean;
|
|
246
|
+
deleted: string;
|
|
247
|
+
}>;
|
|
248
|
+
/**
|
|
249
|
+
* Get Memory Relations - Graph connections
|
|
250
|
+
*/
|
|
251
|
+
getMemoryRelations(memoryId: string): Promise<{
|
|
252
|
+
memory_id: string;
|
|
253
|
+
relations: any[];
|
|
254
|
+
count: number;
|
|
255
|
+
}>;
|
|
256
|
+
/**
|
|
257
|
+
* Oracle Search - Tree-guided document navigation with research mode
|
|
258
|
+
*/
|
|
259
|
+
oracleSearch(params: {
|
|
260
|
+
query: string;
|
|
261
|
+
project: string;
|
|
262
|
+
max_results?: number;
|
|
263
|
+
mode?: "search" | "research";
|
|
264
|
+
max_steps?: number;
|
|
265
|
+
}): Promise<any>;
|
|
266
|
+
/**
|
|
267
|
+
* Autosubscribe - Auto-index project dependencies
|
|
268
|
+
*/
|
|
269
|
+
autosubscribe(params: {
|
|
270
|
+
project: string;
|
|
271
|
+
source: {
|
|
272
|
+
type: "github" | "local";
|
|
273
|
+
owner?: string;
|
|
274
|
+
repo?: string;
|
|
275
|
+
path?: string;
|
|
276
|
+
};
|
|
277
|
+
dependency_file?: "package.json" | "requirements.txt" | "Cargo.toml" | "go.mod" | "Gemfile";
|
|
278
|
+
index_limit?: number;
|
|
279
|
+
auto_sync?: boolean;
|
|
280
|
+
}): Promise<{
|
|
281
|
+
success: boolean;
|
|
282
|
+
discovered: number;
|
|
283
|
+
indexed: number;
|
|
284
|
+
errors: string[];
|
|
285
|
+
dependencies?: any[];
|
|
286
|
+
auto_sync_enabled: boolean;
|
|
287
|
+
}>;
|
|
288
|
+
/**
|
|
289
|
+
* Create Shared Context - Save and share a conversation
|
|
290
|
+
*/
|
|
291
|
+
createSharedContext(params: {
|
|
292
|
+
session_id: string;
|
|
293
|
+
project: string;
|
|
294
|
+
title?: string;
|
|
295
|
+
include_memories?: boolean;
|
|
296
|
+
include_chunks?: boolean;
|
|
297
|
+
expiry_days?: number;
|
|
298
|
+
}): Promise<{
|
|
299
|
+
success: boolean;
|
|
300
|
+
share_id: string;
|
|
301
|
+
share_url: string;
|
|
302
|
+
title: string;
|
|
303
|
+
memories_count: number;
|
|
304
|
+
messages_count: number;
|
|
305
|
+
expires_at: string;
|
|
306
|
+
}>;
|
|
307
|
+
/**
|
|
308
|
+
* Load Shared Context - View shared context (public endpoint)
|
|
309
|
+
*/
|
|
310
|
+
loadSharedContext(shareId: string): Promise<{
|
|
311
|
+
share_id: string;
|
|
312
|
+
title: string;
|
|
313
|
+
created_at: string;
|
|
314
|
+
expires_at: string;
|
|
315
|
+
memories: any[];
|
|
316
|
+
messages: any[];
|
|
317
|
+
chunks?: any[];
|
|
318
|
+
metadata: any;
|
|
319
|
+
}>;
|
|
320
|
+
/**
|
|
321
|
+
* Resume from Shared Context - Fork shared context to new session
|
|
322
|
+
*/
|
|
323
|
+
resumeFromSharedContext(params: {
|
|
324
|
+
share_id: string;
|
|
325
|
+
project: string;
|
|
326
|
+
new_session_id?: string;
|
|
327
|
+
}): Promise<{
|
|
328
|
+
success: boolean;
|
|
329
|
+
session_id: string;
|
|
330
|
+
memories_restored: number;
|
|
331
|
+
messages_restored: number;
|
|
332
|
+
chunks_restored: number;
|
|
333
|
+
}>;
|
|
334
|
+
/**
|
|
335
|
+
* Consolidate Memories - Find and merge duplicates
|
|
336
|
+
*/
|
|
337
|
+
consolidateMemories(params: {
|
|
338
|
+
project: string;
|
|
339
|
+
similarity_threshold?: number;
|
|
340
|
+
auto_merge?: boolean;
|
|
341
|
+
dry_run?: boolean;
|
|
342
|
+
}): Promise<any>;
|
|
343
|
+
/**
|
|
344
|
+
* Update Importance Decay - Apply time-based relevance scoring
|
|
345
|
+
*/
|
|
346
|
+
updateImportanceDecay(params: {
|
|
347
|
+
project: string;
|
|
348
|
+
decay_function?: "exponential" | "linear" | "logarithmic";
|
|
349
|
+
half_life_days?: number;
|
|
350
|
+
access_boost?: number;
|
|
351
|
+
auto_archive?: boolean;
|
|
352
|
+
archive_threshold?: number;
|
|
353
|
+
}): Promise<{
|
|
354
|
+
success: boolean;
|
|
355
|
+
memories_updated: number;
|
|
356
|
+
average_importance: number;
|
|
357
|
+
memories_archived: number;
|
|
358
|
+
config: any;
|
|
359
|
+
}>;
|
|
360
|
+
/**
|
|
361
|
+
* Get Importance Statistics
|
|
362
|
+
*/
|
|
363
|
+
getImportanceStats(project: string): Promise<{
|
|
364
|
+
project_id: string;
|
|
365
|
+
statistics: any;
|
|
366
|
+
}>;
|
|
367
|
+
/**
|
|
368
|
+
* Get Cache Statistics
|
|
369
|
+
*/
|
|
370
|
+
getCacheStats(): Promise<{
|
|
371
|
+
cache_type: string;
|
|
372
|
+
hit_rate: number;
|
|
373
|
+
total_requests: number;
|
|
374
|
+
hits: number;
|
|
375
|
+
misses: number;
|
|
376
|
+
size_bytes: number;
|
|
377
|
+
keys_count: number;
|
|
378
|
+
average_latency_ms: number;
|
|
379
|
+
uptime_seconds: number;
|
|
380
|
+
}>;
|
|
381
|
+
/**
|
|
382
|
+
* Warm Cache - Preload common queries
|
|
383
|
+
*/
|
|
384
|
+
warmCache(params: {
|
|
385
|
+
project: string;
|
|
386
|
+
queries: string[];
|
|
387
|
+
ttl_seconds?: number;
|
|
388
|
+
}): Promise<{
|
|
389
|
+
success: boolean;
|
|
390
|
+
queries_warmed: number;
|
|
391
|
+
errors: string[];
|
|
392
|
+
cache_size_increase_bytes: number;
|
|
393
|
+
}>;
|
|
394
|
+
/**
|
|
395
|
+
* Clear Cache Pattern
|
|
396
|
+
*/
|
|
397
|
+
clearCache(params: {
|
|
398
|
+
pattern?: string;
|
|
399
|
+
clear_all?: boolean;
|
|
400
|
+
}): Promise<{
|
|
401
|
+
success: boolean;
|
|
402
|
+
keys_cleared: number;
|
|
403
|
+
bytes_freed: number;
|
|
404
|
+
}>;
|
|
405
|
+
/**
|
|
406
|
+
* Get Cost Summary - Cost tracking overview
|
|
407
|
+
*/
|
|
408
|
+
getCostSummary(params: {
|
|
409
|
+
project?: string;
|
|
410
|
+
start_date?: string;
|
|
411
|
+
end_date?: string;
|
|
412
|
+
}): Promise<any>;
|
|
413
|
+
/**
|
|
414
|
+
* Get Cost Breakdown - Detailed cost analysis
|
|
415
|
+
*/
|
|
416
|
+
getCostBreakdown(params: {
|
|
417
|
+
project?: string;
|
|
418
|
+
group_by?: "model" | "task" | "day" | "hour";
|
|
419
|
+
start_date?: string;
|
|
420
|
+
end_date?: string;
|
|
421
|
+
}): Promise<any>;
|
|
422
|
+
/**
|
|
423
|
+
* Get Savings Report - Compare actual vs always-Opus costs
|
|
424
|
+
*/
|
|
425
|
+
getCostSavings(params: {
|
|
426
|
+
project?: string;
|
|
427
|
+
start_date?: string;
|
|
428
|
+
end_date?: string;
|
|
429
|
+
}): Promise<any>;
|
|
164
430
|
}
|
|
165
431
|
|
|
166
432
|
export { type Memory, type Project, type QueryParams, type QueryResult, type Source, type WhisperConfig, WhisperContext, WhisperContext as default };
|
package/index.d.ts
CHANGED
|
@@ -123,30 +123,55 @@ declare class WhisperContext {
|
|
|
123
123
|
}>): Promise<{
|
|
124
124
|
ingested: number;
|
|
125
125
|
}>;
|
|
126
|
+
/**
|
|
127
|
+
* Add Context - Quick method to inject context without full document format
|
|
128
|
+
* Ideal for agents to add context on the fly
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* await client.addContext({
|
|
132
|
+
* project: "my-app",
|
|
133
|
+
* content: "User prefers dark mode and TypeScript over JavaScript"
|
|
134
|
+
* });
|
|
135
|
+
*/
|
|
136
|
+
addContext(params: {
|
|
137
|
+
project: string;
|
|
138
|
+
content: string;
|
|
139
|
+
title?: string;
|
|
140
|
+
metadata?: Record<string, any>;
|
|
141
|
+
}): Promise<{
|
|
142
|
+
ingested: number;
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* Add Memory - Creates a memory using the SOTA memory system
|
|
146
|
+
* This is the recommended method for conversational memory
|
|
147
|
+
*/
|
|
126
148
|
addMemory(params: {
|
|
127
149
|
project: string;
|
|
128
150
|
content: string;
|
|
129
|
-
memory_type?: "factual" | "
|
|
151
|
+
memory_type?: "factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
130
152
|
user_id?: string;
|
|
131
153
|
session_id?: string;
|
|
132
154
|
agent_id?: string;
|
|
133
155
|
importance?: number;
|
|
134
156
|
metadata?: Record<string, any>;
|
|
135
157
|
expires_in_seconds?: number;
|
|
136
|
-
}): Promise<
|
|
158
|
+
}): Promise<{
|
|
159
|
+
id: string;
|
|
160
|
+
success: boolean;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Search Memories - Searches memories using SOTA memory search with temporal reasoning
|
|
164
|
+
* This is the recommended method for memory retrieval
|
|
165
|
+
*/
|
|
137
166
|
searchMemories(params: {
|
|
138
167
|
project: string;
|
|
139
168
|
query: string;
|
|
140
169
|
user_id?: string;
|
|
141
170
|
session_id?: string;
|
|
142
171
|
agent_id?: string;
|
|
143
|
-
memory_type?: "factual" | "
|
|
172
|
+
memory_type?: "factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction";
|
|
144
173
|
top_k?: number;
|
|
145
|
-
}): Promise<
|
|
146
|
-
memories: Array<Memory & {
|
|
147
|
-
score: number;
|
|
148
|
-
}>;
|
|
149
|
-
}>;
|
|
174
|
+
}): Promise<any>;
|
|
150
175
|
createApiKey(params: {
|
|
151
176
|
name: string;
|
|
152
177
|
scopes?: string[];
|
|
@@ -161,6 +186,272 @@ declare class WhisperContext {
|
|
|
161
186
|
keys: any[];
|
|
162
187
|
}>;
|
|
163
188
|
getUsage(days?: number): Promise<any>;
|
|
189
|
+
/**
|
|
190
|
+
* SOTA Memory Search - Search memories with temporal and type filtering
|
|
191
|
+
*/
|
|
192
|
+
searchMemoriesSOTA(params: {
|
|
193
|
+
query: string;
|
|
194
|
+
project: string;
|
|
195
|
+
user_id?: string;
|
|
196
|
+
session_id?: string;
|
|
197
|
+
question_date?: string;
|
|
198
|
+
top_k?: number;
|
|
199
|
+
memory_types?: Array<"factual" | "preference" | "event" | "relationship" | "opinion" | "goal" | "instruction">;
|
|
200
|
+
include_inactive?: boolean;
|
|
201
|
+
include_chunks?: boolean;
|
|
202
|
+
include_relations?: boolean;
|
|
203
|
+
}): Promise<any>;
|
|
204
|
+
/**
|
|
205
|
+
* Ingest Session - Create memories from a conversation
|
|
206
|
+
*/
|
|
207
|
+
ingestSession(params: {
|
|
208
|
+
project: string;
|
|
209
|
+
session_id: string;
|
|
210
|
+
user_id?: string;
|
|
211
|
+
messages: Array<{
|
|
212
|
+
role: string;
|
|
213
|
+
content: string;
|
|
214
|
+
timestamp: string;
|
|
215
|
+
}>;
|
|
216
|
+
}): Promise<{
|
|
217
|
+
success: boolean;
|
|
218
|
+
memories_created: number;
|
|
219
|
+
relations_created: number;
|
|
220
|
+
memories_invalidated: number;
|
|
221
|
+
errors?: string[];
|
|
222
|
+
}>;
|
|
223
|
+
/**
|
|
224
|
+
* Get Session Memories - Recent memories from a session
|
|
225
|
+
*/
|
|
226
|
+
getSessionMemories(params: {
|
|
227
|
+
session_id: string;
|
|
228
|
+
project: string;
|
|
229
|
+
limit?: number;
|
|
230
|
+
since_date?: string;
|
|
231
|
+
}): Promise<{
|
|
232
|
+
memories: any[];
|
|
233
|
+
count: number;
|
|
234
|
+
}>;
|
|
235
|
+
/**
|
|
236
|
+
* Get User Profile - Long-term user preferences and facts
|
|
237
|
+
*/
|
|
238
|
+
getUserProfile(params: {
|
|
239
|
+
user_id: string;
|
|
240
|
+
project: string;
|
|
241
|
+
memory_types?: string;
|
|
242
|
+
}): Promise<{
|
|
243
|
+
user_id: string;
|
|
244
|
+
memories: any[];
|
|
245
|
+
count: number;
|
|
246
|
+
}>;
|
|
247
|
+
/**
|
|
248
|
+
* Get Memory Versions - Version chain history
|
|
249
|
+
*/
|
|
250
|
+
getMemoryVersions(memoryId: string): Promise<{
|
|
251
|
+
memory_id: string;
|
|
252
|
+
versions: any[];
|
|
253
|
+
count: number;
|
|
254
|
+
}>;
|
|
255
|
+
/**
|
|
256
|
+
* Update Memory - Create a new version
|
|
257
|
+
*/
|
|
258
|
+
updateMemory(memoryId: string, params: {
|
|
259
|
+
content: string;
|
|
260
|
+
reasoning?: string;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
success: boolean;
|
|
263
|
+
new_memory_id: string;
|
|
264
|
+
old_memory_id: string;
|
|
265
|
+
}>;
|
|
266
|
+
/**
|
|
267
|
+
* Delete Memory - Soft delete
|
|
268
|
+
*/
|
|
269
|
+
deleteMemory(memoryId: string): Promise<{
|
|
270
|
+
success: boolean;
|
|
271
|
+
deleted: string;
|
|
272
|
+
}>;
|
|
273
|
+
/**
|
|
274
|
+
* Get Memory Relations - Graph connections
|
|
275
|
+
*/
|
|
276
|
+
getMemoryRelations(memoryId: string): Promise<{
|
|
277
|
+
memory_id: string;
|
|
278
|
+
relations: any[];
|
|
279
|
+
count: number;
|
|
280
|
+
}>;
|
|
281
|
+
/**
|
|
282
|
+
* Oracle Search - Tree-guided document navigation with research mode
|
|
283
|
+
*/
|
|
284
|
+
oracleSearch(params: {
|
|
285
|
+
query: string;
|
|
286
|
+
project: string;
|
|
287
|
+
max_results?: number;
|
|
288
|
+
mode?: "search" | "research";
|
|
289
|
+
max_steps?: number;
|
|
290
|
+
}): Promise<any>;
|
|
291
|
+
/**
|
|
292
|
+
* Autosubscribe - Auto-index project dependencies
|
|
293
|
+
*/
|
|
294
|
+
autosubscribe(params: {
|
|
295
|
+
project: string;
|
|
296
|
+
source: {
|
|
297
|
+
type: "github" | "local";
|
|
298
|
+
owner?: string;
|
|
299
|
+
repo?: string;
|
|
300
|
+
path?: string;
|
|
301
|
+
};
|
|
302
|
+
dependency_file?: "package.json" | "requirements.txt" | "Cargo.toml" | "go.mod" | "Gemfile";
|
|
303
|
+
index_limit?: number;
|
|
304
|
+
auto_sync?: boolean;
|
|
305
|
+
}): Promise<{
|
|
306
|
+
success: boolean;
|
|
307
|
+
discovered: number;
|
|
308
|
+
indexed: number;
|
|
309
|
+
errors: string[];
|
|
310
|
+
dependencies?: any[];
|
|
311
|
+
auto_sync_enabled: boolean;
|
|
312
|
+
}>;
|
|
313
|
+
/**
|
|
314
|
+
* Create Shared Context - Save and share a conversation
|
|
315
|
+
*/
|
|
316
|
+
createSharedContext(params: {
|
|
317
|
+
session_id: string;
|
|
318
|
+
project: string;
|
|
319
|
+
title?: string;
|
|
320
|
+
include_memories?: boolean;
|
|
321
|
+
include_chunks?: boolean;
|
|
322
|
+
expiry_days?: number;
|
|
323
|
+
}): Promise<{
|
|
324
|
+
success: boolean;
|
|
325
|
+
share_id: string;
|
|
326
|
+
share_url: string;
|
|
327
|
+
title: string;
|
|
328
|
+
memories_count: number;
|
|
329
|
+
messages_count: number;
|
|
330
|
+
expires_at: string;
|
|
331
|
+
}>;
|
|
332
|
+
/**
|
|
333
|
+
* Load Shared Context - View shared context (public endpoint)
|
|
334
|
+
*/
|
|
335
|
+
loadSharedContext(shareId: string): Promise<{
|
|
336
|
+
share_id: string;
|
|
337
|
+
title: string;
|
|
338
|
+
created_at: string;
|
|
339
|
+
expires_at: string;
|
|
340
|
+
memories: any[];
|
|
341
|
+
messages: any[];
|
|
342
|
+
chunks?: any[];
|
|
343
|
+
metadata: any;
|
|
344
|
+
}>;
|
|
345
|
+
/**
|
|
346
|
+
* Resume from Shared Context - Fork shared context to new session
|
|
347
|
+
*/
|
|
348
|
+
resumeFromSharedContext(params: {
|
|
349
|
+
share_id: string;
|
|
350
|
+
project: string;
|
|
351
|
+
new_session_id?: string;
|
|
352
|
+
}): Promise<{
|
|
353
|
+
success: boolean;
|
|
354
|
+
session_id: string;
|
|
355
|
+
memories_restored: number;
|
|
356
|
+
messages_restored: number;
|
|
357
|
+
chunks_restored: number;
|
|
358
|
+
}>;
|
|
359
|
+
/**
|
|
360
|
+
* Consolidate Memories - Find and merge duplicates
|
|
361
|
+
*/
|
|
362
|
+
consolidateMemories(params: {
|
|
363
|
+
project: string;
|
|
364
|
+
similarity_threshold?: number;
|
|
365
|
+
auto_merge?: boolean;
|
|
366
|
+
dry_run?: boolean;
|
|
367
|
+
}): Promise<any>;
|
|
368
|
+
/**
|
|
369
|
+
* Update Importance Decay - Apply time-based relevance scoring
|
|
370
|
+
*/
|
|
371
|
+
updateImportanceDecay(params: {
|
|
372
|
+
project: string;
|
|
373
|
+
decay_function?: "exponential" | "linear" | "logarithmic";
|
|
374
|
+
half_life_days?: number;
|
|
375
|
+
access_boost?: number;
|
|
376
|
+
auto_archive?: boolean;
|
|
377
|
+
archive_threshold?: number;
|
|
378
|
+
}): Promise<{
|
|
379
|
+
success: boolean;
|
|
380
|
+
memories_updated: number;
|
|
381
|
+
average_importance: number;
|
|
382
|
+
memories_archived: number;
|
|
383
|
+
config: any;
|
|
384
|
+
}>;
|
|
385
|
+
/**
|
|
386
|
+
* Get Importance Statistics
|
|
387
|
+
*/
|
|
388
|
+
getImportanceStats(project: string): Promise<{
|
|
389
|
+
project_id: string;
|
|
390
|
+
statistics: any;
|
|
391
|
+
}>;
|
|
392
|
+
/**
|
|
393
|
+
* Get Cache Statistics
|
|
394
|
+
*/
|
|
395
|
+
getCacheStats(): Promise<{
|
|
396
|
+
cache_type: string;
|
|
397
|
+
hit_rate: number;
|
|
398
|
+
total_requests: number;
|
|
399
|
+
hits: number;
|
|
400
|
+
misses: number;
|
|
401
|
+
size_bytes: number;
|
|
402
|
+
keys_count: number;
|
|
403
|
+
average_latency_ms: number;
|
|
404
|
+
uptime_seconds: number;
|
|
405
|
+
}>;
|
|
406
|
+
/**
|
|
407
|
+
* Warm Cache - Preload common queries
|
|
408
|
+
*/
|
|
409
|
+
warmCache(params: {
|
|
410
|
+
project: string;
|
|
411
|
+
queries: string[];
|
|
412
|
+
ttl_seconds?: number;
|
|
413
|
+
}): Promise<{
|
|
414
|
+
success: boolean;
|
|
415
|
+
queries_warmed: number;
|
|
416
|
+
errors: string[];
|
|
417
|
+
cache_size_increase_bytes: number;
|
|
418
|
+
}>;
|
|
419
|
+
/**
|
|
420
|
+
* Clear Cache Pattern
|
|
421
|
+
*/
|
|
422
|
+
clearCache(params: {
|
|
423
|
+
pattern?: string;
|
|
424
|
+
clear_all?: boolean;
|
|
425
|
+
}): Promise<{
|
|
426
|
+
success: boolean;
|
|
427
|
+
keys_cleared: number;
|
|
428
|
+
bytes_freed: number;
|
|
429
|
+
}>;
|
|
430
|
+
/**
|
|
431
|
+
* Get Cost Summary - Cost tracking overview
|
|
432
|
+
*/
|
|
433
|
+
getCostSummary(params: {
|
|
434
|
+
project?: string;
|
|
435
|
+
start_date?: string;
|
|
436
|
+
end_date?: string;
|
|
437
|
+
}): Promise<any>;
|
|
438
|
+
/**
|
|
439
|
+
* Get Cost Breakdown - Detailed cost analysis
|
|
440
|
+
*/
|
|
441
|
+
getCostBreakdown(params: {
|
|
442
|
+
project?: string;
|
|
443
|
+
group_by?: "model" | "task" | "day" | "hour";
|
|
444
|
+
start_date?: string;
|
|
445
|
+
end_date?: string;
|
|
446
|
+
}): Promise<any>;
|
|
447
|
+
/**
|
|
448
|
+
* Get Savings Report - Compare actual vs always-Opus costs
|
|
449
|
+
*/
|
|
450
|
+
getCostSavings(params: {
|
|
451
|
+
project?: string;
|
|
452
|
+
start_date?: string;
|
|
453
|
+
end_date?: string;
|
|
454
|
+
}): Promise<any>;
|
|
164
455
|
}
|
|
165
456
|
|
|
166
457
|
export { type Memory, type Project, type QueryParams, type QueryResult, type Source, type WhisperConfig, WhisperContext, WhisperContext as default };
|
package/index.js
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// ../src/sdk/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
WhisperContext: () => WhisperContext,
|
|
24
|
+
default: () => index_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
2
27
|
var WhisperContext = class {
|
|
3
28
|
apiKey;
|
|
4
29
|
baseUrl;
|
|
@@ -60,16 +85,66 @@ var WhisperContext = class {
|
|
|
60
85
|
body: JSON.stringify({ documents })
|
|
61
86
|
});
|
|
62
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Add Context - Quick method to inject context without full document format
|
|
90
|
+
* Ideal for agents to add context on the fly
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await client.addContext({
|
|
94
|
+
* project: "my-app",
|
|
95
|
+
* content: "User prefers dark mode and TypeScript over JavaScript"
|
|
96
|
+
* });
|
|
97
|
+
*/
|
|
98
|
+
async addContext(params) {
|
|
99
|
+
const projectData = await this.listProjects();
|
|
100
|
+
const project = projectData.projects.find(
|
|
101
|
+
(p) => p.name === params.project || p.slug === params.project
|
|
102
|
+
);
|
|
103
|
+
if (!project) {
|
|
104
|
+
throw new Error(`Project '${params.project}' not found`);
|
|
105
|
+
}
|
|
106
|
+
return this.ingest(project.id, [
|
|
107
|
+
{
|
|
108
|
+
title: params.title || "Context",
|
|
109
|
+
content: params.content,
|
|
110
|
+
metadata: params.metadata || { source: "addContext" }
|
|
111
|
+
}
|
|
112
|
+
]);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add Memory - Creates a memory using the SOTA memory system
|
|
116
|
+
* This is the recommended method for conversational memory
|
|
117
|
+
*/
|
|
63
118
|
async addMemory(params) {
|
|
64
|
-
return this.request("/v1/
|
|
119
|
+
return this.request("/v1/memory/ingest/session", {
|
|
65
120
|
method: "POST",
|
|
66
|
-
body: JSON.stringify(
|
|
121
|
+
body: JSON.stringify({
|
|
122
|
+
project: params.project,
|
|
123
|
+
session_id: params.session_id || `single-${Date.now()}`,
|
|
124
|
+
user_id: params.user_id,
|
|
125
|
+
messages: [{
|
|
126
|
+
role: "user",
|
|
127
|
+
content: params.content,
|
|
128
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
129
|
+
}]
|
|
130
|
+
})
|
|
67
131
|
});
|
|
68
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Search Memories - Searches memories using SOTA memory search with temporal reasoning
|
|
135
|
+
* This is the recommended method for memory retrieval
|
|
136
|
+
*/
|
|
69
137
|
async searchMemories(params) {
|
|
70
|
-
return this.request("/v1/
|
|
138
|
+
return this.request("/v1/memory/search", {
|
|
71
139
|
method: "POST",
|
|
72
|
-
body: JSON.stringify(
|
|
140
|
+
body: JSON.stringify({
|
|
141
|
+
query: params.query,
|
|
142
|
+
project: params.project,
|
|
143
|
+
user_id: params.user_id,
|
|
144
|
+
session_id: params.session_id,
|
|
145
|
+
memory_types: params.memory_type ? [params.memory_type] : void 0,
|
|
146
|
+
top_k: params.top_k || 10
|
|
147
|
+
})
|
|
73
148
|
});
|
|
74
149
|
}
|
|
75
150
|
async createApiKey(params) {
|
|
@@ -84,9 +159,202 @@ var WhisperContext = class {
|
|
|
84
159
|
async getUsage(days = 30) {
|
|
85
160
|
return this.request(`/v1/usage?days=${days}`);
|
|
86
161
|
}
|
|
162
|
+
// ─── SOTA Memory System ─────────────────────────────────────────
|
|
163
|
+
/**
|
|
164
|
+
* SOTA Memory Search - Search memories with temporal and type filtering
|
|
165
|
+
*/
|
|
166
|
+
async searchMemoriesSOTA(params) {
|
|
167
|
+
return this.request("/v1/memory/search", {
|
|
168
|
+
method: "POST",
|
|
169
|
+
body: JSON.stringify(params)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Ingest Session - Create memories from a conversation
|
|
174
|
+
*/
|
|
175
|
+
async ingestSession(params) {
|
|
176
|
+
return this.request("/v1/memory/ingest/session", {
|
|
177
|
+
method: "POST",
|
|
178
|
+
body: JSON.stringify(params)
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get Session Memories - Recent memories from a session
|
|
183
|
+
*/
|
|
184
|
+
async getSessionMemories(params) {
|
|
185
|
+
const query = new URLSearchParams({
|
|
186
|
+
project: params.project,
|
|
187
|
+
...params.limit && { limit: params.limit.toString() },
|
|
188
|
+
...params.since_date && { since_date: params.since_date }
|
|
189
|
+
});
|
|
190
|
+
return this.request(`/v1/memory/session/${params.session_id}?${query}`);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get User Profile - Long-term user preferences and facts
|
|
194
|
+
*/
|
|
195
|
+
async getUserProfile(params) {
|
|
196
|
+
const query = new URLSearchParams({
|
|
197
|
+
project: params.project,
|
|
198
|
+
...params.memory_types && { memory_types: params.memory_types }
|
|
199
|
+
});
|
|
200
|
+
return this.request(`/v1/memory/profile/${params.user_id}?${query}`);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get Memory Versions - Version chain history
|
|
204
|
+
*/
|
|
205
|
+
async getMemoryVersions(memoryId) {
|
|
206
|
+
return this.request(`/v1/memory/${memoryId}/versions`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Update Memory - Create a new version
|
|
210
|
+
*/
|
|
211
|
+
async updateMemory(memoryId, params) {
|
|
212
|
+
return this.request(`/v1/memory/${memoryId}`, {
|
|
213
|
+
method: "PUT",
|
|
214
|
+
body: JSON.stringify(params)
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Delete Memory - Soft delete
|
|
219
|
+
*/
|
|
220
|
+
async deleteMemory(memoryId) {
|
|
221
|
+
return this.request(`/v1/memory/${memoryId}`, { method: "DELETE" });
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get Memory Relations - Graph connections
|
|
225
|
+
*/
|
|
226
|
+
async getMemoryRelations(memoryId) {
|
|
227
|
+
return this.request(`/v1/memory/${memoryId}/relations`);
|
|
228
|
+
}
|
|
229
|
+
// ─── Context Layer ──────────────────────────────────────────────
|
|
230
|
+
/**
|
|
231
|
+
* Oracle Search - Tree-guided document navigation with research mode
|
|
232
|
+
*/
|
|
233
|
+
async oracleSearch(params) {
|
|
234
|
+
return this.request("/v1/oracle/search", {
|
|
235
|
+
method: "POST",
|
|
236
|
+
body: JSON.stringify(params)
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Autosubscribe - Auto-index project dependencies
|
|
241
|
+
*/
|
|
242
|
+
async autosubscribe(params) {
|
|
243
|
+
return this.request("/v1/autosubscribe", {
|
|
244
|
+
method: "POST",
|
|
245
|
+
body: JSON.stringify(params)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Create Shared Context - Save and share a conversation
|
|
250
|
+
*/
|
|
251
|
+
async createSharedContext(params) {
|
|
252
|
+
return this.request("/v1/context/share", {
|
|
253
|
+
method: "POST",
|
|
254
|
+
body: JSON.stringify(params)
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Load Shared Context - View shared context (public endpoint)
|
|
259
|
+
*/
|
|
260
|
+
async loadSharedContext(shareId) {
|
|
261
|
+
return this.request(`/v1/context/shared/${shareId}`);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Resume from Shared Context - Fork shared context to new session
|
|
265
|
+
*/
|
|
266
|
+
async resumeFromSharedContext(params) {
|
|
267
|
+
return this.request("/v1/context/resume", {
|
|
268
|
+
method: "POST",
|
|
269
|
+
body: JSON.stringify(params)
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
// ─── Optimization ───────────────────────────────────────────────
|
|
273
|
+
/**
|
|
274
|
+
* Consolidate Memories - Find and merge duplicates
|
|
275
|
+
*/
|
|
276
|
+
async consolidateMemories(params) {
|
|
277
|
+
return this.request("/v1/memory/consolidate", {
|
|
278
|
+
method: "POST",
|
|
279
|
+
body: JSON.stringify(params)
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Update Importance Decay - Apply time-based relevance scoring
|
|
284
|
+
*/
|
|
285
|
+
async updateImportanceDecay(params) {
|
|
286
|
+
return this.request("/v1/memory/decay/update", {
|
|
287
|
+
method: "POST",
|
|
288
|
+
body: JSON.stringify(params)
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get Importance Statistics
|
|
293
|
+
*/
|
|
294
|
+
async getImportanceStats(project) {
|
|
295
|
+
return this.request(`/v1/memory/decay/stats?project=${project}`);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Get Cache Statistics
|
|
299
|
+
*/
|
|
300
|
+
async getCacheStats() {
|
|
301
|
+
return this.request("/v1/cache/stats");
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Warm Cache - Preload common queries
|
|
305
|
+
*/
|
|
306
|
+
async warmCache(params) {
|
|
307
|
+
return this.request("/v1/cache/warm", {
|
|
308
|
+
method: "POST",
|
|
309
|
+
body: JSON.stringify(params)
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Clear Cache Pattern
|
|
314
|
+
*/
|
|
315
|
+
async clearCache(params) {
|
|
316
|
+
return this.request("/v1/cache/clear", {
|
|
317
|
+
method: "DELETE",
|
|
318
|
+
body: JSON.stringify(params)
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Get Cost Summary - Cost tracking overview
|
|
323
|
+
*/
|
|
324
|
+
async getCostSummary(params) {
|
|
325
|
+
const query = new URLSearchParams({
|
|
326
|
+
...params.project && { project: params.project },
|
|
327
|
+
...params.start_date && { start_date: params.start_date },
|
|
328
|
+
...params.end_date && { end_date: params.end_date }
|
|
329
|
+
});
|
|
330
|
+
return this.request(`/v1/cost/summary?${query}`);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Get Cost Breakdown - Detailed cost analysis
|
|
334
|
+
*/
|
|
335
|
+
async getCostBreakdown(params) {
|
|
336
|
+
const query = new URLSearchParams({
|
|
337
|
+
...params.project && { project: params.project },
|
|
338
|
+
...params.group_by && { group_by: params.group_by },
|
|
339
|
+
...params.start_date && { start_date: params.start_date },
|
|
340
|
+
...params.end_date && { end_date: params.end_date }
|
|
341
|
+
});
|
|
342
|
+
return this.request(`/v1/cost/breakdown?${query}`);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Get Savings Report - Compare actual vs always-Opus costs
|
|
346
|
+
*/
|
|
347
|
+
async getCostSavings(params) {
|
|
348
|
+
const query = new URLSearchParams({
|
|
349
|
+
...params.project && { project: params.project },
|
|
350
|
+
...params.start_date && { start_date: params.start_date },
|
|
351
|
+
...params.end_date && { end_date: params.end_date }
|
|
352
|
+
});
|
|
353
|
+
return this.request(`/v1/cost/savings?${query}`);
|
|
354
|
+
}
|
|
87
355
|
};
|
|
88
356
|
var index_default = WhisperContext;
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
357
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
358
|
+
0 && (module.exports = {
|
|
359
|
+
WhisperContext
|
|
360
|
+
});
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usewhisper/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "tsup ../src/sdk/index.ts --format esm,cjs --dts --out-dir .",
|
|
6
|
+
"prepublishOnly": "npm run build"
|
|
7
|
+
},
|
|
4
8
|
"description": "TypeScript SDK for Whisper Context API - Add reliable context to your AI agents",
|
|
5
9
|
"main": "index.cjs",
|
|
6
10
|
"module": "index.js",
|
|
7
11
|
"types": "index.d.ts",
|
|
8
12
|
"exports": {
|
|
9
13
|
".": {
|
|
14
|
+
"types": "./index.d.ts",
|
|
10
15
|
"import": "./index.js",
|
|
11
|
-
"require": "./index.cjs"
|
|
12
|
-
"types": "./index.d.ts"
|
|
16
|
+
"require": "./index.cjs"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"files": [
|
|
@@ -34,7 +38,7 @@
|
|
|
34
38
|
"license": "MIT",
|
|
35
39
|
"repository": {
|
|
36
40
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/Alixus/
|
|
41
|
+
"url": "https://github.com/Alixus/"
|
|
38
42
|
},
|
|
39
43
|
"homepage": "https://usewhisper.dev",
|
|
40
44
|
"bugs": {
|