@sovant/sdk 1.4.2 → 1.4.3
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 +46 -2
- package/dist/index.cjs +31 -0
- package/dist/index.d.cts +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,9 +199,51 @@ const recall = await sv.memory.recall({
|
|
|
199
199
|
console.log(recall.results);
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
## List Memories
|
|
203
|
+
|
|
204
|
+
Fetch memories with filtering and pagination. Use `list()` to retrieve recent memories or filter by criteria — it's more efficient than `search()` when you don't need vector similarity.
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
// List recent memories
|
|
208
|
+
const { memories, total, has_more } = await sv.memory.list({
|
|
209
|
+
limit: 20,
|
|
210
|
+
offset: 0
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Filter by thread
|
|
214
|
+
const threadMemories = await sv.memory.list({
|
|
215
|
+
thread_id: "thread-uuid",
|
|
216
|
+
limit: 50
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Filter by type and tags
|
|
220
|
+
const preferences = await sv.memory.list({
|
|
221
|
+
type: "preference",
|
|
222
|
+
tags: ["settings"],
|
|
223
|
+
sort_by: "updated_at",
|
|
224
|
+
sort_order: "desc"
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// Pinned memories only
|
|
228
|
+
const pinned = await sv.memory.list({
|
|
229
|
+
is_pinned: true
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Available parameters:**
|
|
234
|
+
- `limit` — max results (default: 20, max: 100)
|
|
235
|
+
- `offset` — pagination offset
|
|
236
|
+
- `thread_id` — filter by thread
|
|
237
|
+
- `type` — filter by memory type
|
|
238
|
+
- `tags` — filter by tags (must have all)
|
|
239
|
+
- `is_pinned` — filter by pinned status
|
|
240
|
+
- `is_archived` — filter by archived status
|
|
241
|
+
- `sort_by` — `created_at`, `updated_at`, `importance`, or `type`
|
|
242
|
+
- `sort_order` — `asc` or `desc`
|
|
243
|
+
|
|
202
244
|
## Features
|
|
203
245
|
|
|
204
|
-
- **Memory CRUD** — create, retrieve, update, delete memories
|
|
246
|
+
- **Memory CRUD** — create, list, retrieve, update, delete memories
|
|
205
247
|
- **Semantic Search** — query memories with filters and ranking
|
|
206
248
|
- **Threads** — organize memories into conversations or sessions (fully supported in SDK)
|
|
207
249
|
- **Batch Operations** — create multiple memories in one request
|
|
@@ -234,7 +276,9 @@ console.log(recall.results);
|
|
|
234
276
|
|
|
235
277
|
## Versioning & Changelog
|
|
236
278
|
|
|
237
|
-
- **Current release:** 1.4.
|
|
279
|
+
- **Current release:** 1.4.3
|
|
280
|
+
- Version 1.4.3 — add `memory.list()` for filtered pagination
|
|
281
|
+
- Version 1.4.2 — README sync
|
|
238
282
|
- Version 1.4.1 — CJS export fix
|
|
239
283
|
- Version 1.4.0 — full threads support (create, list, get, update, delete)
|
|
240
284
|
- Version 1.3.0 — hybrid recall with profile awareness
|
package/dist/index.cjs
CHANGED
|
@@ -207,6 +207,37 @@ var Sovant = class {
|
|
|
207
207
|
return this.req(`/api/v1/memory/recall?${params.toString()}`, {
|
|
208
208
|
method: "GET"
|
|
209
209
|
});
|
|
210
|
+
},
|
|
211
|
+
/**
|
|
212
|
+
* List memories with filtering and pagination
|
|
213
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
214
|
+
*
|
|
215
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
216
|
+
* Use search() for semantic/vector-based queries.
|
|
217
|
+
* Use recall() for conversational AI queries.
|
|
218
|
+
*
|
|
219
|
+
* @param params - Optional filtering and pagination parameters
|
|
220
|
+
* @returns Paginated list of memories
|
|
221
|
+
*/
|
|
222
|
+
list: (params) => {
|
|
223
|
+
const query = new URLSearchParams();
|
|
224
|
+
if (params?.limit !== void 0)
|
|
225
|
+
query.append("limit", params.limit.toString());
|
|
226
|
+
if (params?.offset !== void 0)
|
|
227
|
+
query.append("offset", params.offset.toString());
|
|
228
|
+
if (params?.thread_id) query.append("thread_id", params.thread_id);
|
|
229
|
+
if (params?.type) query.append("type", params.type);
|
|
230
|
+
if (params?.tags) query.append("tags", params.tags.join(","));
|
|
231
|
+
if (params?.is_pinned !== void 0)
|
|
232
|
+
query.append("is_pinned", params.is_pinned.toString());
|
|
233
|
+
if (params?.is_archived !== void 0)
|
|
234
|
+
query.append("is_archived", params.is_archived.toString());
|
|
235
|
+
if (params?.sort_by) query.append("sort_by", params.sort_by);
|
|
236
|
+
if (params?.sort_order) query.append("sort_order", params.sort_order);
|
|
237
|
+
return this.req(
|
|
238
|
+
`/api/v1/memory?${query.toString()}`,
|
|
239
|
+
{ method: "GET" }
|
|
240
|
+
);
|
|
210
241
|
}
|
|
211
242
|
};
|
|
212
243
|
threads = {
|
package/dist/index.d.cts
CHANGED
|
@@ -17,6 +17,60 @@ type SovantClientOptions = {
|
|
|
17
17
|
}) => void;
|
|
18
18
|
onError?: (err: SovantError) => void;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for listing memories
|
|
22
|
+
*/
|
|
23
|
+
type MemoryListParams = {
|
|
24
|
+
/** Maximum number of memories to return (default: 20, max: 100) */
|
|
25
|
+
limit?: number;
|
|
26
|
+
/** Number of memories to skip for pagination (default: 0) */
|
|
27
|
+
offset?: number;
|
|
28
|
+
/** Filter by thread ID */
|
|
29
|
+
thread_id?: string;
|
|
30
|
+
/** Filter by memory type */
|
|
31
|
+
type?: "journal" | "insight" | "observation" | "task" | "preference";
|
|
32
|
+
/** Filter by tags (memories must have all specified tags) */
|
|
33
|
+
tags?: string[];
|
|
34
|
+
/** Filter by pinned status */
|
|
35
|
+
is_pinned?: boolean;
|
|
36
|
+
/** Filter by archived status */
|
|
37
|
+
is_archived?: boolean;
|
|
38
|
+
/** Sort field (default: created_at) */
|
|
39
|
+
sort_by?: "created_at" | "updated_at" | "importance" | "type";
|
|
40
|
+
/** Sort direction (default: desc) */
|
|
41
|
+
sort_order?: "asc" | "desc";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A memory object returned from the API
|
|
45
|
+
*/
|
|
46
|
+
type Memory = {
|
|
47
|
+
id: string;
|
|
48
|
+
content: string;
|
|
49
|
+
type: string;
|
|
50
|
+
tags: string[];
|
|
51
|
+
metadata?: Record<string, any>;
|
|
52
|
+
thread_id?: string;
|
|
53
|
+
importance?: number;
|
|
54
|
+
created_at: string;
|
|
55
|
+
updated_at: string;
|
|
56
|
+
is_pinned: boolean;
|
|
57
|
+
is_archived: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Response from memory.list()
|
|
61
|
+
*/
|
|
62
|
+
type MemoryListResponse = {
|
|
63
|
+
/** Array of memory objects */
|
|
64
|
+
memories: Memory[];
|
|
65
|
+
/** Total count of memories matching the filter */
|
|
66
|
+
total: number;
|
|
67
|
+
/** Limit used for this query */
|
|
68
|
+
limit: number;
|
|
69
|
+
/** Offset used for this query */
|
|
70
|
+
offset: number;
|
|
71
|
+
/** Whether more results are available */
|
|
72
|
+
has_more: boolean;
|
|
73
|
+
};
|
|
20
74
|
declare class Sovant {
|
|
21
75
|
private apiKey;
|
|
22
76
|
private baseUrl;
|
|
@@ -97,6 +151,18 @@ declare class Sovant {
|
|
|
97
151
|
thread_id?: string;
|
|
98
152
|
limit?: number;
|
|
99
153
|
}) => Promise<unknown>;
|
|
154
|
+
/**
|
|
155
|
+
* List memories with filtering and pagination
|
|
156
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
157
|
+
*
|
|
158
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
159
|
+
* Use search() for semantic/vector-based queries.
|
|
160
|
+
* Use recall() for conversational AI queries.
|
|
161
|
+
*
|
|
162
|
+
* @param params - Optional filtering and pagination parameters
|
|
163
|
+
* @returns Paginated list of memories
|
|
164
|
+
*/
|
|
165
|
+
list: (params?: MemoryListParams) => Promise<MemoryListResponse>;
|
|
100
166
|
};
|
|
101
167
|
threads: {
|
|
102
168
|
/**
|
|
@@ -204,4 +270,4 @@ declare class SovantError extends Error {
|
|
|
204
270
|
constructor(message: string, code: string, status?: number, details?: any);
|
|
205
271
|
}
|
|
206
272
|
|
|
207
|
-
export { Sovant, type SovantClientOptions, SovantError };
|
|
273
|
+
export { type Memory, type MemoryListParams, type MemoryListResponse, Sovant, type SovantClientOptions, SovantError };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,60 @@ type SovantClientOptions = {
|
|
|
17
17
|
}) => void;
|
|
18
18
|
onError?: (err: SovantError) => void;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Parameters for listing memories
|
|
22
|
+
*/
|
|
23
|
+
type MemoryListParams = {
|
|
24
|
+
/** Maximum number of memories to return (default: 20, max: 100) */
|
|
25
|
+
limit?: number;
|
|
26
|
+
/** Number of memories to skip for pagination (default: 0) */
|
|
27
|
+
offset?: number;
|
|
28
|
+
/** Filter by thread ID */
|
|
29
|
+
thread_id?: string;
|
|
30
|
+
/** Filter by memory type */
|
|
31
|
+
type?: "journal" | "insight" | "observation" | "task" | "preference";
|
|
32
|
+
/** Filter by tags (memories must have all specified tags) */
|
|
33
|
+
tags?: string[];
|
|
34
|
+
/** Filter by pinned status */
|
|
35
|
+
is_pinned?: boolean;
|
|
36
|
+
/** Filter by archived status */
|
|
37
|
+
is_archived?: boolean;
|
|
38
|
+
/** Sort field (default: created_at) */
|
|
39
|
+
sort_by?: "created_at" | "updated_at" | "importance" | "type";
|
|
40
|
+
/** Sort direction (default: desc) */
|
|
41
|
+
sort_order?: "asc" | "desc";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A memory object returned from the API
|
|
45
|
+
*/
|
|
46
|
+
type Memory = {
|
|
47
|
+
id: string;
|
|
48
|
+
content: string;
|
|
49
|
+
type: string;
|
|
50
|
+
tags: string[];
|
|
51
|
+
metadata?: Record<string, any>;
|
|
52
|
+
thread_id?: string;
|
|
53
|
+
importance?: number;
|
|
54
|
+
created_at: string;
|
|
55
|
+
updated_at: string;
|
|
56
|
+
is_pinned: boolean;
|
|
57
|
+
is_archived: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Response from memory.list()
|
|
61
|
+
*/
|
|
62
|
+
type MemoryListResponse = {
|
|
63
|
+
/** Array of memory objects */
|
|
64
|
+
memories: Memory[];
|
|
65
|
+
/** Total count of memories matching the filter */
|
|
66
|
+
total: number;
|
|
67
|
+
/** Limit used for this query */
|
|
68
|
+
limit: number;
|
|
69
|
+
/** Offset used for this query */
|
|
70
|
+
offset: number;
|
|
71
|
+
/** Whether more results are available */
|
|
72
|
+
has_more: boolean;
|
|
73
|
+
};
|
|
20
74
|
declare class Sovant {
|
|
21
75
|
private apiKey;
|
|
22
76
|
private baseUrl;
|
|
@@ -97,6 +151,18 @@ declare class Sovant {
|
|
|
97
151
|
thread_id?: string;
|
|
98
152
|
limit?: number;
|
|
99
153
|
}) => Promise<unknown>;
|
|
154
|
+
/**
|
|
155
|
+
* List memories with filtering and pagination
|
|
156
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
157
|
+
*
|
|
158
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
159
|
+
* Use search() for semantic/vector-based queries.
|
|
160
|
+
* Use recall() for conversational AI queries.
|
|
161
|
+
*
|
|
162
|
+
* @param params - Optional filtering and pagination parameters
|
|
163
|
+
* @returns Paginated list of memories
|
|
164
|
+
*/
|
|
165
|
+
list: (params?: MemoryListParams) => Promise<MemoryListResponse>;
|
|
100
166
|
};
|
|
101
167
|
threads: {
|
|
102
168
|
/**
|
|
@@ -204,4 +270,4 @@ declare class SovantError extends Error {
|
|
|
204
270
|
constructor(message: string, code: string, status?: number, details?: any);
|
|
205
271
|
}
|
|
206
272
|
|
|
207
|
-
export { Sovant, type SovantClientOptions, SovantError };
|
|
273
|
+
export { type Memory, type MemoryListParams, type MemoryListResponse, Sovant, type SovantClientOptions, SovantError };
|
package/dist/index.js
CHANGED
|
@@ -182,6 +182,37 @@ var Sovant = class {
|
|
|
182
182
|
return this.req(`/api/v1/memory/recall?${params.toString()}`, {
|
|
183
183
|
method: "GET"
|
|
184
184
|
});
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* List memories with filtering and pagination
|
|
188
|
+
* Returns memories ordered by sort criteria (default: created_at desc)
|
|
189
|
+
*
|
|
190
|
+
* Use list() to fetch recent memories or filter by criteria.
|
|
191
|
+
* Use search() for semantic/vector-based queries.
|
|
192
|
+
* Use recall() for conversational AI queries.
|
|
193
|
+
*
|
|
194
|
+
* @param params - Optional filtering and pagination parameters
|
|
195
|
+
* @returns Paginated list of memories
|
|
196
|
+
*/
|
|
197
|
+
list: (params) => {
|
|
198
|
+
const query = new URLSearchParams();
|
|
199
|
+
if (params?.limit !== void 0)
|
|
200
|
+
query.append("limit", params.limit.toString());
|
|
201
|
+
if (params?.offset !== void 0)
|
|
202
|
+
query.append("offset", params.offset.toString());
|
|
203
|
+
if (params?.thread_id) query.append("thread_id", params.thread_id);
|
|
204
|
+
if (params?.type) query.append("type", params.type);
|
|
205
|
+
if (params?.tags) query.append("tags", params.tags.join(","));
|
|
206
|
+
if (params?.is_pinned !== void 0)
|
|
207
|
+
query.append("is_pinned", params.is_pinned.toString());
|
|
208
|
+
if (params?.is_archived !== void 0)
|
|
209
|
+
query.append("is_archived", params.is_archived.toString());
|
|
210
|
+
if (params?.sort_by) query.append("sort_by", params.sort_by);
|
|
211
|
+
if (params?.sort_order) query.append("sort_order", params.sort_order);
|
|
212
|
+
return this.req(
|
|
213
|
+
`/api/v1/memory?${query.toString()}`,
|
|
214
|
+
{ method: "GET" }
|
|
215
|
+
);
|
|
185
216
|
}
|
|
186
217
|
};
|
|
187
218
|
threads = {
|