@sovant/sdk 1.1.1 → 1.2.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,MAAM;IACT,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,UAAU,CAAS;IACnB,SAAS,CAA+D;IACxE,UAAU,CAAqF;IAC/F,OAAO,CAA8B;IAE7C,YAAY,IAAyB;QACnC,IAAI,CAAC,IAAI,EAAE,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,mBAAmB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IAEO,KAAK,CAAC,GAAG,CAAI,IAAY,EAAE,IAAiB;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QACpC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,4BAA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AAI,CAAC,CAAC;YAC1C,IAAI,CAAC,CAAC,IAAI;gBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACpD,IAAI,CAAC,CAAC,SAAS;gBAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;YACzD,IAAI,CAAC,CAAC,KAAK;gBAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxD,IAAI,CAAC,CAAC,SAAS;gBAAE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;YACzD,IAAI,CAAC,CAAC,OAAO;gBAAE,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE;gBAC5D,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;QACL,CAAC;KACF,CAAC;CACH;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,IAAI,CAAS;IACb,MAAM,CAAU;IAChB,OAAO,CAAO;IAEd,YAAY,OAAe,EAAE,IAAY,EAAE,MAAe,EAAE,OAAa;QACvE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,68 +1,47 @@
1
1
  {
2
2
  "name": "@sovant/sdk",
3
- "version": "1.1.1",
4
- "description": "Official JavaScript/TypeScript SDK for Sovant Memory API",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.mjs",
7
- "types": "./dist/index.d.ts",
3
+ "version": "1.2.0",
4
+ "description": "Sovant Memory-as-a-Service TypeScript SDK",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
13
12
  }
14
13
  },
15
14
  "files": [
16
15
  "dist",
17
16
  "README.md",
18
- "LICENSE",
19
- "CHANGELOG.md"
17
+ "LICENSE"
20
18
  ],
21
19
  "scripts": {
22
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
23
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
24
- "test": "jest",
25
- "test:smoke": "node scripts/smoke-test.js",
26
- "lint": "eslint src --ext ts",
27
- "prepublishOnly": "npm run build"
20
+ "build": "tsc -p tsconfig.build.json",
21
+ "prepublishOnly": "npm run build",
22
+ "lint": "eslint .",
23
+ "format": "prettier -w ."
28
24
  },
29
25
  "keywords": [
30
26
  "sovant",
31
27
  "memory",
32
- "api",
33
- "ai",
34
- "sdk",
35
- "typescript",
36
- "javascript"
28
+ "maas",
29
+ "sdk"
37
30
  ],
38
- "author": "Sovant AI",
31
+ "author": "Sovant",
39
32
  "license": "MIT",
40
33
  "repository": {
41
34
  "type": "git",
42
- "url": "git+https://github.com/sovant-ai/javascript-sdk.git"
35
+ "url": "https://github.com/hechin91/sovant-ai"
43
36
  },
37
+ "homepage": "https://sovant.ai/docs",
44
38
  "bugs": {
45
- "url": "https://github.com/sovant-ai/javascript-sdk/issues"
39
+ "url": "https://github.com/hechin91/sovant-ai/issues"
46
40
  },
47
- "homepage": "https://sovant.ai",
48
41
  "devDependencies": {
49
- "@types/jest": "^29.5.12",
50
- "@types/node": "^20.11.0",
51
- "@typescript-eslint/eslint-plugin": "^6.18.1",
52
- "@typescript-eslint/parser": "^6.18.1",
53
- "eslint": "^8.56.0",
54
- "jest": "^29.7.0",
55
- "ts-jest": "^29.1.1",
56
- "tsup": "^8.0.1",
57
- "typescript": "^5.3.3"
58
- },
59
- "engines": {
60
- "node": ">=14.0.0"
61
- },
62
- "publishConfig": {
63
- "access": "public"
64
- },
65
- "dependencies": {
66
- "node-fetch": "^2.7.0"
42
+ "@types/node": "^24.10.0",
43
+ "eslint": "^9.9.0",
44
+ "prettier": "^3.3.3",
45
+ "typescript": "^5.6.2"
67
46
  }
68
47
  }
package/CHANGELOG.md DELETED
@@ -1,118 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to the Sovant JavaScript/TypeScript SDK will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [1.1.1] - 2025-09-15
9
-
10
- ### Fixed
11
- - **Robust SSE parsing** - Complete rewrite of SSE parser to handle:
12
- - Partial chunk reassembly
13
- - Both `\n\n` and `\r\n\r\n` event boundaries
14
- - Multi-line `data:` fields
15
- - Comment lines starting with `:`
16
- - Optional `event:` and `id:` fields
17
- - **Chat streaming** - Fixed `sendMessage()` to properly stream delta events with API keys
18
- - **API headers** - SDK now uses `x-sovant-api-key` header (matching docs) instead of `Authorization: Bearer`
19
- - **Session creation** - Fixed response parsing to expect session data at root level
20
-
21
- ### Changed
22
- - Improved `sendMessage()` to handle both object and string message formats
23
- - Enhanced SSE event processing to parse JSON `text` fields from API responses
24
-
25
- ## [1.1.0] - 2025-09-15
26
-
27
- ### Added
28
- - **Chat namespace** with SSE streaming support for real-time conversations
29
- - `createSession()` - Create chat sessions with provider/model selection
30
- - `sendMessage()` - Stream responses with async generator pattern
31
- - `getMessages()` - Retrieve chat history
32
- - `getSession()` / `listSessions()` - Session management
33
- - **Keys namespace** for API key management
34
- - `list()`, `create()`, `update()`, `revoke()` - Full key lifecycle
35
- - **Recall namespace** with Phase 1 profile helpers
36
- - `extractProfile()` - Client-side profile entity detection
37
- - `getProfileFacts()` - Retrieve canonical profile facts
38
- - `saveProfileFact()` - Save facts in canonical format
39
- - **baseUrl** config option for custom endpoints
40
- - SSE parser utility for streaming responses
41
- - TypeScript exports for all new types
42
-
43
- ### Changed
44
- - HttpClient properties now public for namespace access
45
- - Enhanced README with Chat streaming examples
46
-
47
- ## [0.4.0] - 2025-01-01
48
-
49
- ### Added
50
- - Complete alignment with live Sovant Memory API at https://sovant.ai
51
- - Full TypeScript support with comprehensive type definitions
52
- - Robust error handling with `SovantError`, `NetworkError`, and `TimeoutError` classes
53
- - Automatic retry logic with exponential backoff for failed requests
54
- - Request timeout support using AbortController
55
- - Debug mode for detailed request/response logging
56
- - Batch operations support for atomic multi-operation transactions
57
- - Thread management for organizing related memories
58
- - Comprehensive README with examples and best practices
59
- - Smoke test script for API verification
60
- - Proper ESM and CommonJS dual package support
61
-
62
- ### Changed
63
- - **BREAKING**: Complete API redesign to match live endpoints
64
- - **BREAKING**: Removed `userId` from all public method signatures (now derived from API key)
65
- - **BREAKING**: Changed from `SovantClient` class to `Sovant` class
66
- - **BREAKING**: Namespace all memory operations under `sovant.memory.*`
67
- - Updated all endpoints to use new paths:
68
- - Collection: `/api/v1/memory` (GET list, POST create)
69
- - By ID: `/api/v1/memories/{id}` (GET, PUT, PATCH, DELETE)
70
- - Search: `/api/v1/memory/search`
71
- - Batch: `/api/v1/memory/batch`
72
- - All response fields now use snake_case to match API format
73
- - Improved error messages and request ID tracking
74
-
75
- ### Fixed
76
- - Proper handling of 204 No Content responses
77
- - Correct content-type detection for response parsing
78
- - Retry logic for transient network failures
79
- - Proper timeout handling with clear error messages
80
-
81
- ### Security
82
- - API keys are now passed as Bearer tokens in Authorization header
83
- - No longer expose userId in client code
84
-
85
- ## [0.3.0] - 2024-11-15
86
-
87
- ### Added
88
- - Initial TypeScript SDK implementation
89
- - Basic CRUD operations for memories
90
- - Simple search functionality
91
- - Thread support
92
-
93
- ### Changed
94
- - Migrated from JavaScript to TypeScript
95
-
96
- ## [0.2.0] - 2024-10-01
97
-
98
- ### Added
99
- - Batch operations support
100
- - Memory metadata fields
101
- - Emotional tone tracking
102
-
103
- ### Fixed
104
- - Memory pagination issues
105
- - Search result relevance scoring
106
-
107
- ## [0.1.0] - 2024-09-01
108
-
109
- ### Added
110
- - Initial SDK release
111
- - Basic memory CRUD operations
112
- - Simple keyword search
113
- - API key authentication
114
-
115
- [0.4.0]: https://github.com/sovant-ai/javascript-sdk/compare/v0.3.0...v0.4.0
116
- [0.3.0]: https://github.com/sovant-ai/javascript-sdk/compare/v0.2.0...v0.3.0
117
- [0.2.0]: https://github.com/sovant-ai/javascript-sdk/compare/v0.1.0...v0.2.0
118
- [0.1.0]: https://github.com/sovant-ai/javascript-sdk/releases/tag/v0.1.0
package/dist/index.d.mts DELETED
@@ -1,433 +0,0 @@
1
- /**
2
- * HTTP Client for Sovant SDK - v1 Core
3
- * Handles retries, timeouts, and error handling
4
- */
5
- interface HttpOptions {
6
- method?: string;
7
- headers?: Record<string, string>;
8
- body?: any;
9
- timeout?: number;
10
- maxRetries?: number;
11
- debug?: boolean;
12
- }
13
- interface HttpResponse<T = any> {
14
- data: T;
15
- status: number;
16
- headers: Record<string, string>;
17
- requestId?: string;
18
- }
19
- declare class HttpClient {
20
- readonly baseUrl: string;
21
- readonly apiKey: string;
22
- private readonly globalOptions;
23
- constructor(baseUrl: string, apiKey: string, globalOptions?: Partial<HttpOptions>);
24
- request<T = any>(path: string, options?: HttpOptions): Promise<HttpResponse<T>>;
25
- private makeRequest;
26
- private calculateRetryDelay;
27
- private sleep;
28
- }
29
-
30
- /**
31
- * Sovant SDK Types - v1 Core
32
- * Single source of truth - DO NOT DEVIATE
33
- */
34
- type MemoryType = 'journal' | 'insight' | 'observation' | 'task' | 'preference';
35
- interface MemoryResponse {
36
- id: string;
37
- thread_id: string | null;
38
- content: string;
39
- type: MemoryType;
40
- tags?: string[];
41
- metadata?: Record<string, unknown>;
42
- created_at: string;
43
- updated_at: string;
44
- }
45
- interface CreateMemoryInput {
46
- content: string;
47
- type: MemoryType;
48
- tags?: string[];
49
- metadata?: Record<string, unknown>;
50
- thread_id?: string;
51
- }
52
- interface UpdateMemoryInput {
53
- content: string;
54
- type: MemoryType;
55
- tags?: string[];
56
- metadata?: Record<string, unknown>;
57
- is_archived?: boolean;
58
- thread_id?: string | null;
59
- }
60
- interface PutMemoryInput extends CreateMemoryInput {
61
- }
62
- interface ListParams {
63
- limit?: number;
64
- offset?: number;
65
- type?: MemoryType;
66
- tags?: string[];
67
- thread_id?: string;
68
- is_archived?: boolean;
69
- }
70
- interface ListResponse {
71
- memories: MemoryResponse[];
72
- total: number;
73
- limit: number;
74
- offset: number;
75
- has_more: boolean;
76
- }
77
- interface SearchParams {
78
- query?: string;
79
- type?: MemoryType;
80
- tags?: string[];
81
- from_date?: string;
82
- to_date?: string;
83
- limit?: number;
84
- thread_id?: string;
85
- }
86
- interface SearchHit extends MemoryResponse {
87
- score: number;
88
- }
89
- interface SearchResponse {
90
- results: SearchHit[];
91
- }
92
- type BatchOp = {
93
- op: 'create';
94
- data: CreateMemoryInput;
95
- } | {
96
- op: 'update';
97
- id: string;
98
- data: Partial<UpdateMemoryInput>;
99
- } | {
100
- op: 'delete';
101
- id: string;
102
- };
103
- interface BatchRequest {
104
- operations: BatchOp[];
105
- }
106
- interface BatchResult {
107
- operation: 'create' | 'update' | 'delete';
108
- index: number;
109
- success: boolean;
110
- id?: string;
111
- data?: any;
112
- error?: string;
113
- }
114
- interface BatchResponse {
115
- results: BatchResult[];
116
- summary: {
117
- total: number;
118
- successful: number;
119
- failed: number;
120
- operations: {
121
- create: number;
122
- update: number;
123
- delete: number;
124
- };
125
- };
126
- transaction_id: string;
127
- }
128
- interface CreateResponse extends MemoryResponse {
129
- ok: true;
130
- }
131
- interface Thread {
132
- id: string;
133
- title: string | null;
134
- metadata?: Record<string, unknown>;
135
- created_at: string;
136
- updated_at: string;
137
- }
138
- interface CreateThreadInput {
139
- title?: string;
140
- metadata?: Record<string, unknown>;
141
- }
142
- interface UpdateThreadInput {
143
- title?: string;
144
- metadata?: Record<string, unknown>;
145
- }
146
- interface ThreadListResponse {
147
- threads: Thread[];
148
- total: number;
149
- limit: number;
150
- offset: number;
151
- has_more: boolean;
152
- }
153
- interface ThreadWithMemories extends Thread {
154
- memories: {
155
- items: MemoryResponse[];
156
- total: number;
157
- limit: number;
158
- offset: number;
159
- has_more: boolean;
160
- };
161
- }
162
- interface LinkMemoryResponse {
163
- ok: boolean;
164
- thread_id: string;
165
- memory_id: string;
166
- }
167
- interface DeleteResponse {
168
- ok: true;
169
- }
170
- interface SovantConfig {
171
- apiKey: string;
172
- baseUrl?: string;
173
- timeout?: number;
174
- maxRetries?: number;
175
- debug?: boolean;
176
- }
177
- interface Session {
178
- id: string;
179
- user_id: string;
180
- title: string;
181
- capture_enabled?: boolean;
182
- use_memory?: boolean;
183
- summary_data?: Record<string, any>;
184
- created_at: string;
185
- updated_at: string;
186
- }
187
- interface CreateSessionInput {
188
- provider?: 'openai' | 'anthropic' | 'google';
189
- model?: string;
190
- title?: string;
191
- }
192
- interface Message {
193
- id: string;
194
- session_id: string;
195
- role: 'user' | 'assistant' | 'system';
196
- content: string;
197
- provider?: string;
198
- model?: string;
199
- created_at: string;
200
- }
201
- interface SendMessageOptions {
202
- message?: string;
203
- provider?: string;
204
- model?: string;
205
- useMemory?: boolean;
206
- captureToMemory?: boolean;
207
- stream?: boolean;
208
- signal?: AbortSignal;
209
- }
210
- interface StreamEvent {
211
- type: 'delta' | 'done' | 'error';
212
- data?: string;
213
- }
214
- interface ApiKey {
215
- id: string;
216
- name: string;
217
- key?: string;
218
- prefix?: string;
219
- created_at: string;
220
- expires_at?: string;
221
- last_used_at?: string;
222
- }
223
- interface UpdateKeyInput {
224
- name?: string;
225
- expires_at?: string;
226
- }
227
- type ProfileEntity = 'name' | 'age' | 'location' | 'preference';
228
- interface ProfileExtraction {
229
- entity: ProfileEntity | null;
230
- value?: string;
231
- }
232
- interface ProfileFacts {
233
- name?: string;
234
- age?: string;
235
- location?: string;
236
- preferences?: string[];
237
- }
238
-
239
- /**
240
- * Sovant SDK Error Classes - v1 Core
241
- */
242
- declare class SovantError extends Error {
243
- readonly code?: string;
244
- readonly status?: number;
245
- readonly requestId?: string;
246
- constructor(message: string, code?: string, status?: number, requestId?: string);
247
- static fromResponse(status: number, body: any, requestId?: string): SovantError;
248
- toJSON(): {
249
- name: string;
250
- message: string;
251
- code: string | undefined;
252
- status: number | undefined;
253
- requestId: string | undefined;
254
- };
255
- }
256
- declare class NetworkError extends SovantError {
257
- constructor(message: string, cause?: Error);
258
- }
259
- declare class TimeoutError extends SovantError {
260
- constructor(message?: string);
261
- }
262
-
263
- /**
264
- * Sovant SDK - v1.1.0
265
- * Universal Memory API for AI Applications
266
- */
267
-
268
- /**
269
- * Main Sovant SDK Client
270
- */
271
- declare class Sovant {
272
- private readonly http;
273
- readonly memory: MemoryNamespace;
274
- readonly threads: ThreadsNamespace;
275
- readonly chat: ChatNamespace;
276
- readonly keys: KeysNamespace;
277
- readonly recall: RecallNamespace;
278
- constructor(config: SovantConfig);
279
- }
280
- /**
281
- * Memory namespace for all memory-related operations
282
- */
283
- declare class MemoryNamespace {
284
- private readonly http;
285
- constructor(http: HttpClient);
286
- /**
287
- * Create a new memory
288
- */
289
- create(input: CreateMemoryInput): Promise<MemoryResponse>;
290
- /**
291
- * List memories with optional filters
292
- */
293
- list(params?: ListParams): Promise<ListResponse>;
294
- /**
295
- * Get a specific memory by ID
296
- */
297
- get(id: string): Promise<MemoryResponse>;
298
- /**
299
- * Update a memory (partial update using PATCH)
300
- */
301
- update(id: string, patch: Partial<UpdateMemoryInput>): Promise<MemoryResponse>;
302
- /**
303
- * Replace a memory (full update using PUT)
304
- */
305
- put(id: string, body: PutMemoryInput): Promise<MemoryResponse>;
306
- /**
307
- * Delete a memory
308
- */
309
- delete(id: string): Promise<DeleteResponse>;
310
- /**
311
- * Search memories using semantic search or filters
312
- */
313
- search(params: SearchParams): Promise<SearchResponse>;
314
- /**
315
- * Execute batch operations atomically
316
- */
317
- batch(body: BatchRequest): Promise<BatchResponse>;
318
- }
319
- /**
320
- * Threads namespace for all thread-related operations
321
- */
322
- declare class ThreadsNamespace {
323
- private readonly http;
324
- constructor(http: HttpClient);
325
- /**
326
- * Create a new thread
327
- */
328
- create(input?: CreateThreadInput): Promise<Thread>;
329
- /**
330
- * List threads with pagination
331
- */
332
- list(params?: {
333
- limit?: number;
334
- offset?: number;
335
- }): Promise<ThreadListResponse>;
336
- /**
337
- * Get a thread by ID, optionally with memories
338
- */
339
- get(id: string, options?: {
340
- includeMemories?: boolean;
341
- limit?: number;
342
- offset?: number;
343
- }): Promise<Thread | ThreadWithMemories>;
344
- /**
345
- * Update a thread
346
- */
347
- update(id: string, input: UpdateThreadInput): Promise<Thread>;
348
- /**
349
- * Delete a thread (memories are unlinked, not deleted)
350
- */
351
- delete(id: string): Promise<{
352
- ok: boolean;
353
- unlinked_memories?: number;
354
- }>;
355
- /**
356
- * Link a memory to a thread
357
- */
358
- linkMemory(threadId: string, memoryId: string): Promise<LinkMemoryResponse>;
359
- }
360
- /**
361
- * Chat namespace for session and messaging operations
362
- */
363
- declare class ChatNamespace {
364
- private readonly http;
365
- constructor(http: HttpClient);
366
- /**
367
- * Create a new chat session
368
- */
369
- createSession(input?: CreateSessionInput): Promise<Session>;
370
- /**
371
- * Get a chat session by ID
372
- */
373
- getSession(sessionId: string): Promise<Session>;
374
- /**
375
- * List chat sessions
376
- */
377
- listSessions(params?: {
378
- limit?: number;
379
- offset?: number;
380
- }): Promise<Session[]>;
381
- /**
382
- * Get messages for a session
383
- */
384
- getMessages(sessionId: string, limit?: number): Promise<Message[]>;
385
- /**
386
- * Send a message with SSE streaming
387
- */
388
- sendMessage(sessionId: string, message: string | SendMessageOptions, opts?: SendMessageOptions): AsyncGenerator<StreamEvent, void, unknown>;
389
- }
390
- /**
391
- * Keys namespace for API key management
392
- */
393
- declare class KeysNamespace {
394
- private readonly http;
395
- constructor(http: HttpClient);
396
- /**
397
- * List API keys
398
- */
399
- list(): Promise<ApiKey[]>;
400
- /**
401
- * Create a new API key
402
- */
403
- create(name: string): Promise<ApiKey>;
404
- /**
405
- * Update an API key
406
- */
407
- update(id: string, patch: UpdateKeyInput): Promise<ApiKey>;
408
- /**
409
- * Revoke an API key
410
- */
411
- revoke(id: string): Promise<void>;
412
- }
413
- /**
414
- * Recall namespace for profile extraction and facts
415
- */
416
- declare class RecallNamespace {
417
- private readonly http;
418
- constructor(http: HttpClient);
419
- /**
420
- * Extract profile entity from text (client-side)
421
- */
422
- extractProfile(text: string): ProfileExtraction;
423
- /**
424
- * Get profile facts from memories
425
- */
426
- getProfileFacts(): Promise<ProfileFacts>;
427
- /**
428
- * Save a profile fact in canonical form
429
- */
430
- saveProfileFact(kind: ProfileEntity, value: string): Promise<MemoryResponse>;
431
- }
432
-
433
- export { type ApiKey, type BatchOp, type BatchRequest, type BatchResponse, type BatchResult, type CreateMemoryInput, type CreateResponse, type CreateSessionInput, type CreateThreadInput, type DeleteResponse, type LinkMemoryResponse, type ListParams, type ListResponse, type MemoryResponse, type MemoryType, type Message, NetworkError, type ProfileEntity, type ProfileExtraction, type ProfileFacts, type PutMemoryInput, type SearchHit, type SearchParams, type SearchResponse, type SendMessageOptions, type Session, Sovant, type SovantConfig, SovantError, type StreamEvent, type Thread, type ThreadListResponse, type ThreadWithMemories, TimeoutError, type UpdateKeyInput, type UpdateMemoryInput, type UpdateThreadInput, Sovant as default };